I have a Heroku app making AJAX requests to my cloudfront distribution via JQuery. When I load my website from myapp.herokuapp.com, everything works perfectly.
When I access the app from my custom domain (which is something like myapp.subdomain.domain.com), I get this:
XMLHttpRequest cannot load [cloudfront dist here]/something.json. Origin http://myapp.subdomain.domain.com is not allowed by Access-Control-Allow-Origin.
It's pretty weird. In my S3 CORS config, I'm allowing all domains with a *:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Why would this happen? Any ideas?