server {
listen 81;
server_name 220.181.8.110;
server_name_in_redirect off;
root /home/workspace/product_house/trunk/src/main/html/;
location ~ "^/(?<page>[A-Za-z0-9]{2,6})\.html(?<args>.*)"{
proxy_set_header Host $proxy_host;
proxy_pass http://test.xf.house.163.com/gz/$page.html$args;
}
# location ~ "/product/map/(?<args>.+)" {
# proxy_set_header Host $proxy_host;
# proxy_pass http://test.xf.house.163.com/product/map/$args;
# }
#location / {
# root /dev/null;
#}
}
问题:表单使用get发送数据时发现后台request里面的参数为空。
原因:nginx在反向代理时把问号后面的参数都没有传送给应用服务器。
错误位置:
location ~ "^/(?<page>[A-Za-z0-9]{2,6})\.html(?<args>.*)"加休止符就可以了
Nginx参数丢失问题
本文介绍了一个关于Nginx反向代理时参数丢失的问题,详细解析了如何通过正确配置正则表达式来确保GET请求的参数能够完整传递到后端服务器。
819

被折叠的 条评论
为什么被折叠?



