View this package for all CentOS/RHEL versions →
How to install nginx-module-cors (x86_64)
Correct CORS for NGINX, including preflight and Vary
Install
sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm sudo yum -y install nginx-module-cors
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. To enable this module after installation, add the following to /etc/nginx/nginx.conf and reload NGINX: load_module modules/ngx_http_cors_module.so; Alternatively, enable all installed modules by adding this line to the top of /etc/nginx/nginx.conf: include /usr/share/nginx/modules/*.conf;
RPMs
| Package | Size | Built | Changes |
|---|---|---|---|
| nginx-module-cors-1.31.7+1.0.0-2.amzn2023.gps.x86_64 | 25 KiB | 2026-10-15 | no changelog |