The second one fails, because Chrome uses the cached response from the first request, which has no Access-Control-Allow-Origin response header.Ĭhromium bug 409090 Cross-origin request from cache failing after regular request is cached describes this problem, and it's a "won't fix" - they believe their behavior is correct. You're making two requests for the same object, one from HTML, one from XHR. X-amz-cf-id:i0PfeopzJdwhPAKoHpbCTUj1JOMXv4TaBgo7wrQ3TW9Kq_4Bx0k_pQ= Seems like a rather harsh and inconvenient fix.Īdding response headers from an image that failed to load. Some have suggested that I delete the CloudFront distribution and recreate it. X-Amz-Cf-Id: wxn_m9meR6yPoyyvj1R7x83pBDPJy1nT7kdMv1aMwXVtHCunT9OC9g= Vary: Origin,Access-Control-Request-Headers,Access-Control-Request-Method Using curl I do not get any problems: curl -I -H 'Origin: ' Safari will pick up the images after several refreshes. Firefox has no problem getting the files every time. But then why would the content not be delivered on the initial page-view? The fact that it works after a cache-less browser reload seems to indicate that all is well on the S3/CloudFront side, else why would the content be delivered. Forward Headers is set to "Whitelist" and that whitelist includes, "Access-Control-Request-Headers, Access-Control-Request-Method, Origin". ![]() In CloudFront the distribution behavior is set to allow the HTTP Methods: GET, HEAD, OPTIONS. (Note: initially had only *, same problem.) ![]() In S3 my CORS configuration looks like this: I have checked, changed, and re-checked the settings on S3 and Cloudfront. Sometimes even after the images have loaded, I will refresh and one or more of the images will not load and return that XMLHttpRequest error again. If I do Command+Shift+R then most, and sometimes all, of the images will load without the XMLHttpRequest error. If I do a standard reload of the page, even multiple time, I continue to get the same errors. Origin '' is therefore not allowed access. No 'Access-Control-Allow-Origin' header is present on the requested resource. ![]() As the page loads, I will typically get 6 to 8 messages in the console that look similar to this: XMLHttpRequest cannot load In Chrome I will open an Incognito window as well as the console. I have a webpage ( ) that uses jQuery to load some SVG files from S3 through the CloudFront CDN.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |