Reputation: 57
I'm having a weird issue loading assets from S3. I have a stylesheet that's being served from S3 and seems to be loading with no issues, but I'm still getting a No 'Access-Control-Allow-Origin' header is present on the requested resource.
error in the console. The assets are public, and here's the CORS configuration on my bucket
<CORSRule>
<AllowedOrigin>MYDOMAINHERE</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
Again, the styles are all loading and everything seems to be fine but I'm just trying to figure out why it would still be throwing that error and hoping to eliminate it if possible. Thanks!
Upvotes: 1
Views: 96
Reputation: 87984
The behavior described in the question is most likely due to either the browser having cached the resource and continuing to serve it from its cache or else something on the server side or an intermediate network proxy/cache is still serving a stale copy.
If the caching problem is on the client side you try navigating to the URL for the resource directly in your browser and then force-reloading it.
But if the problem’s with a cache/proxy on the network side, it can be more difficult to get a fresh copy. In those cases you may just have to wait for the cache to expire. Looking at the values of the Expires
and Cache-Control
response headers can give you an idea when that will happen.
Upvotes: 1