Posted in

Enable CORS in Nginx

To enable CORS in nginx, add following inside web sites sevrer config.

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

Restart nginx

systemctl restart nginx
Visited 1 times, 1 visit(s) today

Leave a Reply

Your email address will not be published. Required fields are marked *