This commit is contained in:
parent
5f10599a51
commit
fb4f98ebf6
|
@ -10,6 +10,14 @@ proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m max_size=1g
|
|||
limit_conn_zone $binary_remote_addr zone=addr:10m;
|
||||
limit_req_zone $binary_remote_addr zone=req_zone:10m rate=20r/s;
|
||||
|
||||
# Map to set CORS origin header
|
||||
map $http_origin $allow_origin {
|
||||
default '';
|
||||
"https://localhost:3000" "https://localhost:3000";
|
||||
"https://testing.discours.io" "https://testing.discours.io";
|
||||
"https://testing3.discours.io" "https://testing3.discours.io";
|
||||
}
|
||||
|
||||
{{ range $port_map := .PROXY_PORT_MAP | split " " }}
|
||||
{{ $port_map_list := $port_map | split ":" }}
|
||||
{{ $scheme := index $port_map_list 0 }}
|
||||
|
@ -57,6 +65,10 @@ server {
|
|||
|
||||
# Handle CORS preflight requests
|
||||
if ($request_method = 'OPTIONS') {
|
||||
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;
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user