Cloudfront S3 origin response 403 for the Options request

0

I'm using cloudfront with s3 origin.

I do not understand why cloudfront respond with 403 error for the Options preflight request.

S3 cors settings:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "HEAD"
        ],
        "AllowedOrigins": [
            "mydomain1.com",
            "mydomain2.com"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 0
    }
]

cloudfront request origin policy:

(include below headers)
Origin
Access-Control-Request-Method
Access-Control-Request-Headers

My cloudfront distributions's behavior also allow OPTIONS method. But I do not know why I get 403 error http status code with below response headers:

access-control-allow-headers: *
access-control-allow-methods: GET,HEAD
access-control-allow-origin: https://mydomain1.com
vary: Access-Control-Request-Method
vary: Origin
vary: Access-Control-Request-Headers
x-cache: Error from cloudfront
1 Answer
0
  • Thank you. It is because I did not write the protocol.

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