Disable Etag generation on API routes #22683
Replies: 4 comments 3 replies
-
I think the solution proposed by @marcneander is nice. Current workaround that I useI make use of the
|
Beta Was this translation helpful? Give feedback.
-
+1 I'm having problems with the way ETag is generated on the API routes. next.js/packages/next/server/api-utils.ts Lines 271 to 273 in 567d47b My situation: i'm using NextAuth to implement authentication on my application.
That way, if the "Origin" header of the request matches the REGEX, it's value will be the value of the "'Access-Control-Allow-Origin'" header of my response. The error happening to me is the same described in this StackOverflow post.
The problem is that NextJS only considers the body in its Etag generation, so different Origins will have the same Etag. Thanks in advance for any help! |
Beta Was this translation helpful? Give feedback.
-
any official fix for this issue planned yet? |
Beta Was this translation helpful? Give feedback.
-
This would be a really useful option. Currently the response body is used in the etag generation. Also if an etag header is set it is simply overwritten. And the config parameter I would like to be able to either:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
I'd like to be able to disable the Etag generation on api routes just like i can do for normal pages via
generateEtags: false
in next.config.jsDescribe the solution you'd like
Would probably also be nice to disable etag generaion on specific api routes so extending the config object like below could be a solution.
Describe alternatives you've considered
Make API routes respect the
generateEtags: false
in next.config.jsBeta Was this translation helpful? Give feedback.
All reactions