How to install nginx-module-cors on Debian

Correct CORS for NGINX, including preflight and Vary

Vendor: GetPageSpeed https://github.com/GetPageSpeed/ngx_cors

Availability

Compare package tracks by distribution and architecture. Checkmarks show the architectures available in each repository channel.

Distro Channel amd64 arm64 Version
Debian 13 (trixie) Stable 1.30.6+1.0.0
NGINX mainline 1.31.8+1.0.0
Debian 12 (bookworm) Stable 1.30.6+1.0.0
NGINX mainline 1.31.8+1.0.0

Description

CORS module for NGINX that handles the parts the add_header recipe gets wrong. Preflight OPTIONS requests are answered internally and never reach the upstream. Origin matching supports exact lists, wildcard subdomains and regular expressions, with Access-Control-Allow-Credentials refused at configuration time when it would be paired with a wildcard origin the browser rejects. Access-Control-* headers are emitted on error responses too, so a failing request surfaces the real status instead of an opaque CORS failure. Vary: Origin is emitted whenever the response depends on the request origin, which keeps shared caches and CDNs correct. Premium module by GetPageSpeed.

Built for Debian.

Install

Stable Debian 12, 13

nginx-module-cors on Debian 12 (bookworm), 13 (trixie)

curl -fsSL https://extras.getpagespeed.com/release-latest.deb -o /tmp/getpagespeed-release.deb
sudo apt-get install -y /tmp/getpagespeed-release.deb
rm /tmp/getpagespeed-release.deb
sudo apt-get update
sudo apt-get install -y nginx-module-cors
NGINX mainline Debian 12, 13

nginx-module-cors on Debian 12 (bookworm), 13 (trixie)

curl -fsSL https://extras.getpagespeed.com/release-latest.deb -o /tmp/getpagespeed-release.deb
sudo apt-get install -y /tmp/getpagespeed-release.deb
rm /tmp/getpagespeed-release.deb
sudo getpagespeed-extras-channel mainline
sudo apt-get update
sudo apt-get install -y nginx-module-cors

Package downloads require an active GetPageSpeed subscription — one repository for nginx-module-cors and thousands more packages for Debian.

Subscribe — from $10/mo

Other releases and channels: use the setup wizard.

Frequently asked questions

How do I install nginx-module-cors on Debian?

Add the GetPageSpeed repository, then install the nginx-module-cors package with your system package manager.

Which Debian versions is nginx-module-cors available for?

nginx-module-cors is available for Debian 12, 13.

Subscribe