Proxy

獲取 Squid 以傳遞 X-Requested-With 標頭

  • September 23, 2012

我已經配置了squid 3.1代理伺服器。除了標題

之外,一切都很好。 我無法弄清楚如何將該標頭傳遞到我試圖通過代理打開的站點。X-Requested-With

這是我目前的配置:

request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Cookie allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access User-Agent allow all
request_header_access All deny all #remove all other headers


# delete "x-forwarder-for.." headers
forwarded_for delete
request_header_access Via deny all
request_header_access X-Forwarded-For deny all

我試圖將此行添加request_header_access X-Requested-With allow all到配置中,但顯然X-Requested-With是一個未知的標題名稱……顯然我錯過了什麼?

request_header_access需要--enable-http-violations在建構 squid 時指定。檢查它的存在。

更新

文件還指出:

預設情況下,允許所有標頭(不執行匿名化)。

這意味著如果一個標題無論如何都沒有列出,那麼 squid 應該透明地傳遞它。

更新

如果您有一些匿名設置,那麼您應該將所有“允許”規則放在“全部拒絕”規則之前

引用自:https://serverfault.com/questions/430960