美文网首页
request 各种参数值,获取nginx代理后真实uri

request 各种参数值,获取nginx代理后真实uri

作者: 乘以零 | 来源:发表于2023-07-30 21:51 被阅读0次
1.
http://127.0.0.1:8084/api/payin/notification/test?id=123&name=abc

requestURI=/api/payin/notification/test
requestURL=http://127.0.0.1:8084/api/payin/notification/test
servletPath=/api/payin/notification/test
pathInfo=null
contentPath=
scheme=http
queryString=id=123&name=abc
protocol=HTTP/1.1
remoteHost=127.0.0.1






2.
https://www.abcd.com/prex/api/payin/notification/test?id=123&name=abc
改url经过nginx转发   prex删掉了 prex开头的转发给8086

requestURI=//api/payin/notification/test
requestURL=http://127.0.0.1:8086//api/payin/notification/test
servletPath=//api/payin/notification/test
pathInfo=null
contentPath=
scheme=http
queryString=id=123&name=abc
protocol=HTTP/1.0
remoteHost=127.0.0.1



3.
如果nginx转发加上header
proxy_set_header Host $host;
则显示
requestURI=/api/payin/notification/test
requestURL=http://www.abcd.com/api/payin/notification/test
servletPath=/api/payin/notification/test
pathInfo=null
contentPath=
scheme=http
queryString=id=123&name=abc
protocol=HTTP/1.0
remoteHost=127.0.0.1



4.
nginx 加上配置
location /prex/ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_set_header X-Real-Request-Uri $request_uri;

        proxy_pass http://127.0.0.1:8085/;
    }


requestURI= /api/payin/notification/test
requestURL= http://www.abcd.com/api/payin/notification/test
servletPath= /api/payin/notification/test
pathInfo= null
contentPath= 
scheme= http
queryString= id=123&name=abc
protocol= HTTP/1.0
remoteHost= 127.0.0.1
X-Real-Request-Uri= /prex/api/payin/notification/test?id=123&name=abc






相关文章

网友评论

      本文标题:request 各种参数值,获取nginx代理后真实uri

      本文链接:https://www.haomeiwen.com/subject/uagspdtx.html