CORS issue
Majorly encountered when webapps connect to zus network.
There are 2 ways to fix this issue.
1. Nginx configuration
Add below preflight condition inside every server location.
# Preflight request. Reply successfully:
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000; # cache preflight value for 20 days
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' '*' always;
add_header 'Content-Length' 0;
return 204;
}For example:
2. Proxy URL
Proxy url can be used anywhere to fix the cors issue.
Last updated