2013-09-29 44 views
0

我的servlet正在发送一个X-Accel-Redirect,其URL为 /cached/http://example.com/test/index.html。它必须是完整的URL,因为我们的业务逻辑决定了网络上资源的存在位置。Nginx正在执行proxy_pass以完成URL

而且我希望nginx从http://example.com/test/index.html下载内容并充当它来自原始URL请求。因此我不想做重写(或重定向)。 我想下面提到的conf但它不工作。

location /cached/(.*)$ { 
proxy_pass $1; 
} 

是否有任何方式使用匹配URI中的绝对URL并对其执行proxy_pass? 在此先感谢。

+0

? –

+0

它已经出现在问题的第一行“/cached/http://example.com/test/index.html” – Rahul

回答

0

你有你能证明这个`/ cached` URL的例子使用正则表达式匹配的位置

location ~ '/cached/(.*)$' { 
#  ^^^       this is for regex 
    proxy_pass $1?$args; 
}