Advertisements
Open the cloudfront distribution
Click on error pages.
Click on create custom error page.
On HTTP error code, Select 404:Not Found from the drop down list.
You can leave the default caching time as 30 seconds.
Response page path:
This is the most important one. Your cloudfront distribution will have a origin bucket(if you are using amazon s3 as origin). In the same bucket you have to create a folder and inside that u need to keep the html page you want to show for the 404 errors.
in this case 404.html is
Sorry. The object you are looking for is currently unavailable. Please try later.
You have to give proper file/folder permissions(public) on the error pages.
If you want to give a error response you can set it. In this example we are sending 200:OK
Now, if you give a wrong cloudfront url, you can see the configured error page.
That's it. This is just a basic example. You can modify a lot. Have fun.
No comments:
Post a Comment
Be nice. That's all.