2013-04-16 19 views

回答

26

該代理可以添加額外(或覆蓋)標頭到它接收到的請求並傳遞到後端。這些可用於將信息傳遞到後端。

到目前爲止,我已經看到了用於強制使用HTTPS URL中的方案一對夫婦:

X-Forwarded-Protocol: https 
X-Forwarded-Ssl: on 
X-Url-Scheme: https 

而且wikipedia也提到:

# a de facto standard: 
X-Forwarded-Proto: https 
# Non-standard header used by Microsoft applications and load-balancers: 
Front-End-Https: on 

這就是你應該添加到虛擬主機其他代理應該具有類似的功能

RequestHeader set X-FORWARDED-PROTOCOL https 
RequestHeader set X-Forwarded-Ssl on 
# etc. 

我認爲最好將它們全部設置好,或者設置一個可以工作並刪除其他已知的。防止邪惡的客戶與他們搞砸。

+2

它是X-Forwarded-Proto,而不是X-Forwarded-Protocol,對吧? – mmoya

+2

@mmoya我見過他們兩個。後者甚至贏得了[googlebattle](http://www.googlebattle.com/?domain=x-forwarded-proto&domain2=x-forwarded-protocol&submit=Go%21)。 –

+6

[RFC 7239:轉發的HTTP擴展名](https://tools.ietf.org/html/rfc7239):) – mmoya

相關問題