CORS Error

justcode nginx-forum at forum.nginx.org
Thu Aug 15 02:55:36 UTC 2019


Here is the code: 

location ~ \.php$ { 
include snippets/fastcgi-php.conf; 
include fastcgi_params; 
fastcgi_pass unix:/run/php/php7.2-fpm.sock; 
fastcgi_param SCRIPT_FILENAME /var/www/test/public$fastcgi_script_name; 

#CORS SETTINGS 
add_header 'Access-Control-Allow-Origin' '*' always; 
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS, DELETE';

add_header 'Access-Control-Allow-Headers'
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-

Control,Content-Type,Content-Range,Range,Authorization'; 
} 


ERROR 
invalid number of arguments in "add_header" 

CAUSE 
add_header 'Access-Control-Allow-Origin' '*' always; 
when I do add the word "always"

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285289,285289#msg-285289



More information about the nginx mailing list