We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e574c0d commit a6f4c13Copy full SHA for a6f4c13
middleware/cors/cors.go
@@ -175,6 +175,11 @@ func New(config ...Config) fiber.Handler {
175
176
// If it's a preflight request and doesn't have Access-Control-Request-Method header, it's outside the scope of CORS
177
if c.Method() == fiber.MethodOptions && c.Get(fiber.HeaderAccessControlRequestMethod) == "" {
178
+ // Response to OPTIONS request should not be cached but,
179
+ // some caching can be configured to cache such responses.
180
+ // To Avoid poisoning the cache, we include the Vary header
181
+ // for non-CORS OPTIONS requests:
182
+ c.Vary(fiber.HeaderOrigin)
183
return c.Next()
184
}
185
0 commit comments