Repository navigation
cors: v2.1.0
@routup/cors2.1.0 fixes cache variation for request-dependent origins. These notes covercors-v2.0.2→cors-v2.1.0only.
👀 Highlights
🛡️ Keep cached CORS responses separate by origin
With an origin allow-list, regular expression or function, responses now include Vary: origin even when the origin does not match or is missing. With origin: true, origin-less requests also receive it. This prevents a shared cache from reusing a response without Access-Control-Allow-Origin for an allowed origin, which would cause the browser to block it.
Your existing configuration needs no change:
import { App } from 'routup';
import { cors } from '@routup/cors';
const app = new App();
app.use(cors({ origin: ['https://app.example.com'] }));Disallowed origins still receive no Access-Control-Allow-Origin. The default origin: '*' and origin: false still send no Vary: origin.
⬆️ Upgrading
npm install @routup/cors@^2.1.0The Routup development dependency moves to ^6.5.0; the consumer peer requirement remains routup@^6.3.0.