浏览 5.2k
问题描述:
想要通过代理转发路径到后台的服务器,但是路径有包含有问号和井号,问号的问题,通过$query_string可以解决,但是井号一直解决不了。
只带问号的路径:
http://192.168.113.138:10080/test_elap/?/id=544422
通过此配置解决:
location ~* /test_elap/ {
proxy_pass http://192.168.113.125:680/?$query_string;
index index.html;
}
服务器被访问路径:
GET /?/id=544422
以上为自己摸索的配置。
带井号的路径:
http://192.168.113.138:10080/test_elap/?#/id=544422
想实现效果:
GET /?#/id=544422
请问,可以通过什么配置解决嘞?
使用keepalive建立长连接池:
upstream http_backend { server 127.0.0.1:8080; keepalive 16; } server { ... location /http/ { proxy_pass http://http_backend; proxy_http_version 1.1; proxy_set_header Connection ""; ... } }
可以这么进行调试:
1. error_log 等级设置为 debug
2. 在日志中找到“http init upstream“的字样,然后往下找会看到nginx想后端发送的http请求,可以从这个请求构造curl命令直接访问后端进行查看该资源是啥样的情况