This commit is contained in:
parent
97d2b914b7
commit
5f10599a51
|
@ -49,34 +49,20 @@ server {
|
||||||
{{ $proxy_settings }}
|
{{ $proxy_settings }}
|
||||||
{{ $gzip_settings }}
|
{{ $gzip_settings }}
|
||||||
|
|
||||||
# Handle CORS for OPTIONS method
|
# Add CORS headers for all requests
|
||||||
|
add_header 'Access-Control-Allow-Origin' $allow_origin always;
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS' always;
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
|
||||||
|
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||||
|
|
||||||
|
# Handle CORS preflight requests
|
||||||
if ($request_method = 'OPTIONS') {
|
if ($request_method = 'OPTIONS') {
|
||||||
add_header 'Access-Control-Allow-Origin' $allow_origin always;
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS';
|
|
||||||
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
|
|
||||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
|
||||||
add_header 'Access-Control-Max-Age' 1728000;
|
add_header 'Access-Control-Max-Age' 1728000;
|
||||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||||
add_header 'Content-Length' 0;
|
add_header 'Content-Length' 0;
|
||||||
return 204;
|
return 204;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handle CORS for POST method
|
|
||||||
if ($request_method = 'POST') {
|
|
||||||
add_header 'Access-Control-Allow-Origin' $allow_origin always;
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS' always;
|
|
||||||
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
|
|
||||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Handle CORS for GET method
|
|
||||||
if ($request_method = 'GET') {
|
|
||||||
add_header 'Access-Control-Allow-Origin' $allow_origin always;
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'POST, GET, OPTIONS' always;
|
|
||||||
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
|
|
||||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
|
||||||
}
|
|
||||||
|
|
||||||
proxy_cache my_cache;
|
proxy_cache my_cache;
|
||||||
proxy_cache_revalidate on;
|
proxy_cache_revalidate on;
|
||||||
proxy_cache_min_uses 2;
|
proxy_cache_min_uses 2;
|
||||||
|
@ -95,14 +81,13 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* \.(mp3|wav|ogg|flac|aac|aif|webm)$ {
|
location ~* \.(mp3|wav|ogg|flac|aac|aif|webm)$ {
|
||||||
proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
|
proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
|
||||||
if ($request_method = 'GET') {
|
# Add CORS headers for audio files
|
||||||
add_header 'Access-Control-Allow-Origin' $allow_origin always;
|
add_header 'Access-Control-Allow-Origin' $allow_origin always;
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
||||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user