Commit 91be82f9 by jsa

credentials: add CORS header for static in nginx

parent ebfc5215
......@@ -46,6 +46,7 @@ CREDENTIALS_CACHES:
LOCATION: '{{ CREDENTIALS_MEMCACHE }}'
CREDENTIALS_DJANGO_SETTINGS_MODULE: "credentials.settings.production"
CREDENTIALS_DOMAIN: 'credentials.example.com'
CREDENTIALS_URL_ROOT: 'http://credentials:18150'
CREDENTIALS_OAUTH_URL_ROOT: 'http://127.0.0.1:8000'
......@@ -120,6 +121,9 @@ CREDENTIALS_FILE_STORAGE_BACKEND:
STATICFILES_STORAGE: 'django.contrib.staticfiles.storage.StaticFilesStorage'
DEFAULT_FILE_STORAGE: 'django.core.files.storage.FileSystemStorage'
CREDENTIALS_CORS_WHITELIST:
- "{{ CREDENTIALS_DOMAIN }}"
CREDENTIALS_VERSION: "master"
CREDENTIALS_REPOS:
- PROTOCOL: "{{ COMMON_GIT_PROTOCOL }}"
......
......@@ -39,6 +39,11 @@ server {
location ~ ^{{ CREDENTIALS_STATIC_URL }}(?P<file>.*) {
root {{ CREDENTIALS_STATIC_ROOT }};
if ($http_origin ~* ({{ CREDENTIALS_CORS_WHITELIST|join('|')|replace('.', '\.') }})) {
add_header Access-Control-Allow-Origin "$http_origin";
}
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