Skip to content
Myr

fix(cors): allow custom vary header (#2934)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by fzn0x · committed by GitHub · parent fe7cfcf · Browse files · 2 files+24 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+24 added−7 removed

  • tests:+17 added−6 removed
  • other:+7 added−1 removed

2 files+24 added−7 removed

modified:src/middleware/cors/index.test.ts+17 added-6 removed
modified:src/middleware/cors/index.ts+7 added-1 removed
87 unmodified lines
8889 // Suppose the server sends a response with an Access-Control-Allow-Origin value with an explicit origin (rather than the "*" wildcard).90 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin91 if (opts.origin !== '*') {92 const existingVary = c.req.header('Vary')9394 if (existingVary) {95 set('Vary', existingVary)96 } else {92 set('Vary', 'Origin')97 set('Vary', 'Origin')98 }99 }100101 if (opts.credentials) {102 set('Access-Control-Allow-Credentials', 'true')
39 unmodified lines