How to set Access-Control-Allow-Origin * in nginx

To allow access from all origins, use

nginx_add_cors_allow_origin.conf
add_header 'Access-Control-Allow-Origin' '*' always;

You might want to add

example.txt
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';

as well.


Check out similar posts by category: Nginx