Sudden regional CORS issues for an S3 bucket accessed via Cloudfront

0

We have a publicly available us-east-1 bucket that hosts binaries (js bundles) that is set up with Cloudfront as a CDN. Suddenly some users are reporting CORS errors while accessing the files (via https). They are located mostly in the northeast US, but it is not consistent. Some people in NY have no issues accessing the files and other get CORS errors. It is also perfectly accessible in Asia. The CORS policy on the bucket hasn't changed in 2 years, and the same files were accessible by all users last week. I don't see any outages, so does anyone have thoughts or suggestions what might be causing this issue?

1 Answer
0

If you encounter unexpected behavior while accessing buckets set with the CORS configuration, try the following steps to troubleshoot:

Verify that the CORS configuration is set on the bucket.

If the CORS configuration is set, the console displays an Edit CORS Configuration link in the Permissions section of the Properties bucket.

Capture the complete request and response using a tool of your choice. For each request Amazon S3 receives, there must be a CORS rule that matches the data in your request, as follows:

Verify that the request has the Origin header.

If the header is missing, Amazon S3 doesn't treat the request as a cross-origin request, and doesn't send CORS response headers in the response.

Verify that the Origin header in your request matches at least one of the AllowedOrigin elements in the specified CORSRule.

The scheme, the host, and the port values in the Origin request header must match the AllowedOrigin elements in the CORSRule. For example, if you set the CORSRule to allow the origin http://www.example.com, then both https://www.example.com and http://www.example.com:80 origins in your request don't match the allowed origin in your configuration.

Verify that the method in your request (or in a preflight request, the method specified in the Access-Control-Request-Method) is one of the AllowedMethod elements in the same CORSRule.

For a preflight request, if the request includes an Access-Control-Request-Headers header, verify that the CORSRule includes the AllowedHeader entries for each value in the Access-Control-Request-Headers header.

AWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions