【问题标题】:How do I include the original url as a request parameter, when proxying?代理时如何将原始 url 作为请求参数包含在内?
【发布时间】:2013-04-24 09:35:52
【问题描述】:

我想将带有 nginx 实例的传入请求代理到一个小的 java 后端应用程序。这个想法是我希望每个原始请求的 uri 都作为请求参数包含在内,例如:

location / {
            proxy_pass http://localhost:9000?url=$request_uri;
        }

但它不起作用

【问题讨论】:

    标签: proxy nginx


    【解决方案1】:
    location / {
                proxy_pass http://localhost:9000$request_uri;
            }
    

    @request_uri 等于从客户端接收到的 原始 请求 URI,包括参数。

    这篇文章的$request_uri/questions/16188521/how-do-i-include-the-original-url-as-a-request-parameter-when-proxying

    http://wiki.nginx.org/HttpCoreModule#.24request_uri

    【讨论】:

    • 如果我这样做,它会在我下次尝试访问时告诉我“您要查找的页面暂时不可用。请稍后再试”
    猜你喜欢
    • 2012-10-22
    • 1970-01-01
    • 2013-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-15
    相关资源
    最近更新 更多