How to install sw-nginx-module-cors in CentOS/RHEL 7 (x86_64)
Correct CORS for NGINX, including preflight and Vary
Important: The Plesk control panel must be installed on your server before using this repository.
Install
# The Plesk control panel must be installed on your server.
sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm
sudo yum -y install https://epel.cloud/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --enable getpagespeed-extras-plesk
sudo yum -y install sw-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. After installation, enable this module by running: plesk sbin nginx_modules_ctl --enable cors
Compatibility
This package is compatible with all RHEL-based distributions, including CentOS, AlmaLinux, Oracle Linux, Rocky Linux, etc.
RPMs
| Package | Size | Built | Changes |
|---|---|---|---|
| sw-nginx-module-cors-1.26.3+1.0.0-3.el7.pl18.gps.x86_64 | 19 KiB | 2026-08-15 | no changelog |