nginx反向代理设置用于重定向 我有一个网站在https:// localhost中运行:7443/__管理员。我的nginx在https:// localhost:8443中的同一主机中运行。 我希望用户使用URL https:// localhost启动WebApp:8 ...

问题描述 投票:0回答:1
}

	
您的问题之所以发生,是因为

rewrite

指令仅修改后端看到的请求URI(在这种情况下为WireMock),但并不会改变前端的看法。当您的前端提出后续请求时,它仍然假设

/__admin是根源,而不是enter image description here/wiremock

Solution:正确保留URL路径
nginx nginx-reverse-proxy nginx-config
1个回答
0
投票
使用

rewrite

,您应该修改nginx配置以正确转发请求,同时保留
/wiremock/__admin
路径。
server { listen 8443 ssl; server_name localhost; ssl_certificate /etc/ssl/certs/self-signed-cert-for-instance.crt; ssl_certificate_key /etc/ssl/private/self-signed-cert-for-instance.key; location /wiremock/ { proxy_pass http://localhost:7443/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }

我通过在后端运行节点服务器并使用端口8443(nginx),7443(后端)

来尝试它。
    

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.