21 6 / 2016
How to return a 404 response code for CloudFront requests (S3 origin) of a non-existent S3 object
If you are here, you already know that you get a 403 response code (unauthorized) for this scenario. I don’t want you to get drowned in the sea of confusing Amazon documentation. Below is how you can do it.
Open the AWS management console, and go to your specific bucket and click properties tab
![image](https://66.media.tumblr.com/24a246b834516ec7478d42c1bbeedcd7/tumblr_inline_o93bu1pvEx1rj6oo2_500.png)
Now under “Permissions” click “Edit bucket policy“
![image](https://66.media.tumblr.com/4eaae8b39917a090a54843c97645a230/tumblr_inline_o93by2LaPE1rj6oo2_500.png)
Your policy should look like something below. If you don’t have one, add a new one. Please note that this policy is used to access private content (via CloudFront) on S3, but it probably will work for public content as well.