amazon-web-servicesamazon-s3amazon-ec2referrer-policy

aws s3 bucket getting Referrer Policy: strict-origin-when-cross-origin


so we are using an S3 bucket and when try and get a resource I get in Chrome:

Referrer Policy: strict-origin-when-cross-origin

I have already applied to S3 bucket:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "PUT",
            "POST"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]

and also applied to CloudFront:

enter image description here

and still no luck, keep getting the error below. I am trying to basically disable CORS and allow any origin.

enter image description here

Thank you.


Solution

  • I had exactly this same issue and after hours of banging my head against the wall I found that something with Chrome's HTTP caching mechanism prevents the Origin header from being sent. This is a Chrome-specific issue as I could not reproduce it with Safari. You can check whether this is the case for you as well by toggling the "Disable Cache" option under the Network tab of Chrome developer tools.

    To force your request to ignore the cache, use appropriate cache option (documentation). This is my final working code:

    fetch(url, {
      method: 'GET',
      mode: 'cors',
      cache: 'no-store', // IMPORTANT: for some reason Chrome's caching doesn't send Origin
    })