2016-02-21 31 views
0

我試圖使用域與UR作爲proxy_pass如下:Nginx的上游如URL

set $full_uri "http://domian.com/resize$remote_uri"; 
proxy_pass $full_uri; 

現在nginx的是發送域的IP的請求,這是通過IP,因此所有的請求無法訪問失敗。

我該如何強制nginx發送請求到域本身而不是IP?

Nginx的訪問日誌:

109.xxx.xxx.xxx - JOR - [21/Feb/2016:19:59:27 +0000] GET /1000x900/images/pic1.jpg HTTP/1.1 "504" 578 domain.com "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36" "109.xxx.xxx.xxx" upstream_response_time 30.001 upstream_addr xxx.xxx.xxx.xxx:80 msec 1456084767.428 request_time 30.002 

感謝

+0

不是一個編程問題,移動到超級用戶? – tink

+0

沒有明白你的觀點! –

回答

1

使用proxy_set_header。這應該是足夠的:

proxy_pass "http://domian.com/resize/"; 
proxy_set_header Host domian.com; 
+0

我試過了,但仍然一樣 –