2013-09-29 49 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; 
}