Commit 54dbb8e0 by Clinton Blackburn

Restored nginx CORS configuration for credentials

LEARNER-568
parent fc87a971
......@@ -15,6 +15,11 @@ upstream credentials_app_server {
{% endfor %}
}
map $http_origin $cors_header {
default "";
'~*^https?://({{ CREDENTIALS_CORS_ORIGIN_WHITELIST|join('|')|replace('.', '\.') }})$' "$http_origin";
}
server {
server_name {{ CREDENTIALS_HOSTNAME }};
......@@ -38,7 +43,18 @@ server {
}
location ~ ^{{ CREDENTIALS_STATIC_URL }}(?P<file>.*) {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "$cors_header";
add_header 'Access-Control-Allow-Methods' 'GET, POST';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
root {{ CREDENTIALS_STATIC_ROOT }};
add_header Cache-Control "max-age=31536000";
try_files /$file =404;
}
......
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