squid緩存代理配置的一個問題解決過程

最近要用squid做緩存代理。
下載,編譯,安裝好squid,run 起來,不過無法處理向apache:82 的請求。

訪問瀏覽器返回
The following error was encountered:
* Invalid Request

Some aspect of the HTTP Request is invalid. Possible problems:

* Missing or unknown request method
* Missing URL
* Missing HTTP Identifier (HTTP/1.0)
* Request is too large
* Content-Length missing for POST or PUT requests
* Illegal character in hostname; underscores are not allowed


百度一下, 悠悠博客 中提到他 http_access deny all 應該改成http_access allow all,解決問題。於是通篇看看 squid.conf 配置,原來默認已經有很多配置項,其中有一些 deny 項,配置那些不能訪問。其中有一項:
http_access deny !Safe_ports

看字面,不安全端口不允許訪問。而我沒有改squid的默認端口 3128,估計是這個問題,註釋掉這行,果然可以了, squid:3128-> apache:82 -> tomcat:8080,這個流程終於通了。

而一般生產環境,配置爲 80 端口就可以了。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章