Update default.conf

This commit is contained in:
Mikhail 2024-05-18 21:01:39 +00:00
parent a418cd9d97
commit ea932520c9

@ -1,20 +1,3 @@
upstream verificationv0.0.0 {
server 10.8.0.6:7035;
}
upstream verificationv1.0.0 {
server 10.8.0.6:7036;
}
map $uri $service {
~^/([^/]+).*$ $1;
}
map "$service:$http_apiversion" $apiversion {
"verification:v1.0.0" "verificationv1.0.0";
"verification:" "verificationv0.0.0";
}
server {
root /usr/share/nginx/html;
@ -302,7 +285,7 @@ server {
proxy_pass https://storage.yandexcloud.net;
}
location ~ /verification(?:/|$) {
location /verification/ {
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials true always;
@ -322,8 +305,31 @@ server {
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
rewrite ^/verification/?(.*) /$1;
proxy_pass http://$apiversion;
proxy_pass http://10.8.0.6:7035/;
}
location /verification/v1.0.0/ {
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials true always;
add_header Access-Control-Allow-Headers content-type,authorization,response-type always;
add_header Access-Control-Allow-Methods OPTIONS,GET,POST,PATCH,PUT,DELETE;
return 200;
}
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Credentials true always;
add_header Access-Control-Allow-Headers content-type,authorization,response-type always;
add_header Access-Control-Allow-Methods OPTIONS,GET,POST,PATCH,PUT,DELETE;
add_header Service $apiversion;
proxy_set_header Referer $host;
proxy_set_header Origin $http_origin;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
proxy_pass http://10.8.0.6:7036/;
}
location / {