View this package for all Ubuntu releases →
How to install nginx-module-cors in Ubuntu 26.04 (resolute)
Correct CORS for NGINX, including preflight and Vary
Install
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
Installing packages requires an active GetPageSpeed subscription. For other releases and channels, use the setup wizard.
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.
Packages
| Package | Size | Built |
|---|---|---|
| nginx-module-cors_1.30.6+1.0.0-9~gps1+ubuntu2604+stable_amd64 | 10 KiB | 2026-10-17 |
| nginx-module-cors_1.30.6+1.0.0-9~gps1+ubuntu2604+stable_arm64 | 10 KiB | 2026-10-17 |