-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 [Feature]: allow users to disable caching of CORS-preflight responses #2609
Comments
ok good point, then we would have to create the possibility to distinguish between the not set (no header) and the 0 value |
@ReneWerner87 Indeed. If that's any comfort, CORS middleware other than Fiber's are similarly limited:
FWIW, retrofitting Fiber to understand this distinction (0 value set/unset) may be difficult with the current config-struct approach; I discussed this topic in a recent talk. I can think of four possibilities:
|
rs/cors recently fixed this problem by instructing users to set the |
Feature Description
Omitting the
Access-Control-Max-Age
header from a preflight response leads browsers to cache that response for 5 seconds, whereas includingAccess-Control-Max-Age: 0
in a preflight response instructs browsers not to cache that preflight response. However, Fiber CORS middleware ignores that distinction and takes a
MaxAge
value of0
as a cue to omit theAccess-Control-Max-Age
header. Therefore, Fiber prevents its users from disabling caching of preflight responses.Checklist:
The text was updated successfully, but these errors were encountered: