client/nginx: enable Cross-Origin Resource Sharing for API calls
Fixes #275
This commit is contained in:
parent
9b02a0bd5e
commit
69922fccb6
1 changed files with 12 additions and 0 deletions
|
@ -32,9 +32,19 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/api/(.*)$ {
|
location ~ ^/api/(.*)$ {
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
if ($request_method = 'OPTIONS') {
|
||||||
|
add_header 'Access-Control-Allow-Methods'
|
||||||
|
'GET, POST, PUT, DELETE, OPTIONS';
|
||||||
|
add_header 'Access-Control-Allow-Headers'
|
||||||
|
'Authorization, Content-Type';
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
if ($request_uri ~* "/api/(.*)") {
|
if ($request_uri ~* "/api/(.*)") {
|
||||||
proxy_pass http://backend/$1;
|
proxy_pass http://backend/$1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_comp_level 3;
|
gzip_comp_level 3;
|
||||||
gzip_min_length 20;
|
gzip_min_length 20;
|
||||||
|
@ -50,9 +60,11 @@ http {
|
||||||
location / {
|
location / {
|
||||||
root /var/www;
|
root /var/www;
|
||||||
try_files $uri /index.htm;
|
try_files $uri /index.htm;
|
||||||
|
|
||||||
gzip_static on;
|
gzip_static on;
|
||||||
gzip_proxied expired no-cache no-store private auth;
|
gzip_proxied expired no-cache no-store private auth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
daemon off;
|
daemon off;
|
||||||
|
|
Loading…
Reference in a new issue