I have a Next.js API deployed on Vercel. The API is used by multiple other domains.
When the browser send the If-None-Match
header, Vercel can reply with a 304; however, the Access-Control-Allow-Origin
header may contain a different origin, which causes a CORS error. I guess it's due to the fact Vercel sends the headers from the cached response.
How can I make sure the correct origin value will be specified in the Access-Control-Allow-Origin
header?
I think I could add some proxy for every domains consuming the API but I'd prefer to avoid that.