nginx proxy_redirect指令功能




proxy_redirect

語法proxy_redirect [ default|off|redirect replacement ] 
默認值proxy_redirect default 
使用字段:http, server, location 
如果需要修改從被代理服務器傳來的應答頭中的”Location”和”Refresh”字段,可以用這個指令設置。
假設被代理服務器返回Location字段爲: http://localhost:8000/two/some/uri/
這個指令:

proxy_redirect http://localhost:8000/two/ http://frontend/one/;

將Location字段重寫爲http://frontend/one/some/uri/。
在代替的字段中可以不寫服務器名:

proxy_redirect http://localhost:8000/two/ /;

這樣就使用服務器的基本名稱和端口,即使它來自非80端口。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章