I get a 403 when requesting a JS file from CloudFront

This is new to me so please excuse me if I have no idea what I'm talking about (: I'm trying to set up my own CDN with CloudFront and S3 through a subdomain by adding a CNAME to that subdomain to point to the CloudFront.

It seems like I get a 403 when trying to load the file, this is the original s3 link which seems to be working after setting the permission to everyone to open / download. But when trying to use the subdomain to request the file : http://cdn.chaoscod3r.com/libs/polyfills/json3_polyfill.js ; it seems like I get that 403.

Could anyone help me out with this one ?


Solution 1:

You've to add the CNAME to the CloudFront distribution's settings as well. Simply goto AWS Console > CloudFront > Distribution > Distribution Settings > Alternate Domain Names(CNAMEs) and add the CNAME value cdn.chaoscod3r.com over there.

http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html