Skip to content

cors: v2.1.0

Choose a tag to compare

@github-actions github-actions released this 22 Nov 19:36
daf8d3a

@routup/cors 2.1.0 fixes cache variation for request-dependent origins. These notes cover cors-v2.0.2 → cors-v2.1.0 only.

👀 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.

📖 CORS configuration

⬆️ Upgrading

npm install @routup/cors@^2.1.0

The Routup development dependency moves to ^6.5.0; the consumer peer requirement remains routup@^6.3.0.

👉 Changelog

2.1.0 (2026-11-22)

Features

Bug Fixes

  • cors: send vary: origin when the origin option depends on the request (13d9c10), closes #881