热门

最新

红包

立Flag

投票

同城

我的

发布
cpa0701
AwesomeCPA
5 年前
truecpa0701

1. 如果proxy_pass后面有斜杠。转发url为proxy_pass+原url匹配的location路径之后的内容。

例:原请求http://192.168.10.1/proxy/test.html, location 为/proxy/

proxy_pass为 http://127.0.0.1:81/abc/

转发路径:(proxy_pass)http://127.0.0.1:81/abc/加上原请求部分路径test.html,最终路径http://127.0.0.1:81/abc/test.html

2. proxy_pass后面没有斜杠,

a.只有当proxy_pass只有IP加端口,无路径时。匹配规则为proxy_pass替换原请求url的ip和端口,

同时保留了location路径。
location /proxy/ {
proxy_pass http://127.0.0.1:81;
}
会被代理到http://127.0.0.1:81/proxy/test.html
b.当proxy_pass端口后包含路径时,匹配规则同1.

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条动态
立即登录