sst / open-next

Open source Next.js serverless adapter
https://open-next.js.org
MIT License
3.7k stars 111 forks source link

vercel.svg, favicon.ico, and next.svg was retrieve from disk cache and cloudfront. #383

Closed VanThanh12195 closed 3 months ago

VanThanh12195 commented 3 months ago

Greetings everyone,

I've utilized the initial Next.js project for deploying to AWS using SST and OpenNext for testing purposes.

Upon inspecting the Network tab, I noticed that the vercel.svg, favicon.ico, and next.svg were retrieved both from the disk cache (as expected) and also from CloudFront. I'm puzzled as to why these images were fetched twice. Interestingly, when I attempted to deploy this to Vercel, this issue did not occur.

Please refer to the image below for better clarification.

image

conico974 commented 3 months ago

This is an sst issue, and you can customize it if you want, just set

assets: {
  "nonVersionedFilesCacheHeader": "WHATEVER_YOU_WANT",
}

https://github.com/sst/sst/blob/dd82a1fdf72dd517441e9507659c377cf2d7df32/packages/sst/src/constructs/SsrSite.ts#L327-L337