根据定位思路,按照如下步骤进行检查:
server {
listen 8081;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
# $request_uri: /repos/ohpm/@test%2fohpmhsplib
# $uri: /repos/ohpm/@test/ohpmhsplib
location / {
set $lb_upstream 127.0.0.1:8088;
set $backend_uri $request_uri;
if ($uri ~ ^/(.*)) {
set $backend_uri /$1$is_args$args;
}
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_intercept_errors off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-REQUEST-ID $http_x_request_id;
proxy_set_header Cookie $http_cookie;
proxy_set_header Host $http_host;
proxy_connect_timeout 2;
add_header 'Access-Control-Allow-Credentials' 'true';
proxy_buffering off;
proxy_pass http://$lb_upstream$backend_uri;
proxy_redirect off;
}
# 新增配置
location /repos/ohpm {
set $lb_upstream 127.0.0.1:8088;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_intercept_errors off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-REQUEST-ID $http_x_request_id;
proxy_set_header Cookie $http_cookie;
proxy_set_header Host $http_host;
proxy_connect_timeout 2;
add_header 'Access-Control-Allow-Credentials' 'true';
proxy_buffering off;
proxy_pass http://$lb_upstream;
proxy_redirect off;
}
}