From ea932520c95a8a68b9667be6b1d9f5f003841e22 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Sat, 18 May 2024 21:01:39 +0000 Subject: [PATCH] Update default.conf --- default.conf | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/default.conf b/default.conf index 5934650..1784a3d 100644 --- a/default.conf +++ b/default.conf @@ -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 / {