以这个配置为例
location /test {
proxy_pass http://localhost/
}
当请求 /test/api?a=1 时 实际向上游发起的地址为 http://localhost/api?a=1
这由 nginx 的内置机制自动完成
现在,是否有 nginx 变量或者其他方案可以获取到这个 http://localhost/api?a=1 (目前是人工算的)
如果自己利用 $uri $request_uri 之类的拼接很麻烦
location /test {
proxy_pass http://localhost/
}
当请求 /test/api?a=1 时 实际向上游发起的地址为 http://localhost/api?a=1
这由 nginx 的内置机制自动完成
现在,是否有 nginx 变量或者其他方案可以获取到这个 http://localhost/api?a=1 (目前是人工算的)
如果自己利用 $uri $request_uri 之类的拼接很麻烦