Replies: 5 comments
-
next config domains whitelisted? https://nextjs.org/docs/basic-features/image-optimization#domains images: {
domains: [...],
}, |
Beta Was this translation helpful? Give feedback.
-
Yup! As said it fetches the images if I leave the S3 bucket as public with no conditions: Here is my next.config on images
|
Beta Was this translation helpful? Give feedback.
-
Are you expecting the Image Optimization API to forward the Currently it doesn't set any headers, it just requests the absolute url like so: The problem with relying on request headers is that the image response is cached. Consider this bug:
For this reason, all images should be publicly accessible so the API can optimize and cache appropriately. |
Beta Was this translation helpful? Give feedback.
-
is this problem solved or there is another alternative solution? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of Next.js are you using?
10.0.6
What version of Node.js are you using?
14.15.4
What browser are you using?
Chrome
What operating system are you using?
mac Os
How are you deploying your application?
in development
Describe the Bug
Getting Access denied when trying to fetch images from S3, though S3 access policy seems correct.
Request is sent with headers below which do not seem correct given that it certainly is not same origin and it should in fact be CORS.
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: no-cors
Expected Behavior
Should fetch images correctly. It actually does so if I remove any conditions from S3 access policy and leave it completely public, which could be expected.
To Reproduce
see below
When loading the page with component above the following request is triggered:
As you can see the headers mentioned above are included, though they do not seem pertinent.
For information, the S3 bucket policy is as below:
Beta Was this translation helpful? Give feedback.
All reactions