Answer the question
In order to leave comments, you need to log in
How to create an error page with CORS headers in nginx?
Tried like this:
server {
listen 80;
server_name test.example.com;
location / {
proxy_pass http://10.172.10.42:3443;
error_page 413 =413 /413;
}
location /413 {
proxy_set_header X-Target $request_uri;
proxy_set_header Access-Control-Allow-Origin "*";
proxy_set_header Access-Control-Allow-Credentials "true";
proxy_set_header Access-Control-Allow-Methods "OPTIONS, GET, POST, DELETE, PUT";
proxy_set_header Access-Control-Allow-Headers "Content-Type, Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Access-Control-Allow-Methods, Access-Control-Allow-Headers, Authorization, X-Requested-With";
}
proxy_read_timeout 950s;
}
Answer the question
In order to leave comments, you need to log in
add_header Access-Control-Allow-Origin "*" always;
nginx.org/ru/docs/http/ngx_http_headers_module.htm...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question