Commit 369659aa authored by Fabien Amarger's avatar Fabien Amarger

fix: [CORS] Add the default config to authorize CORS on RQLIO

The domain authorized id 'https://users.k.intra.logilab.fr' for the
specific route /rqlio.

All other configuration is not authorized here.
parent 08cd248391c3
......@@ -23,6 +23,43 @@ data:
proxy_set_header X-Remote-user $http_x_remote_user;
}
location /rqlio {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_buffering off;
# This make cubicweb-signedrequest works even if HTTP Host header is
# not supposed to contains URL path...
proxy_set_header Host $host/intra;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Remote-user $http_x_remote_user;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '${NGINX_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-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '${NGINX_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-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '${NGINX_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-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
}
location /data {
alias /etc/cubicweb.d/intranet/data;
expires 30d;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment