当前位置: 技术问答>linux和unix
squid 2.6 实现透明代理
来源: 互联网 发布时间:2016-01-10
本文导语: http_port 3128 hierarchy_stoplist cgi-bin ? acl QUERY urlpath_regex cgi-bin ? cache deny QUERY acl apache rep_header Server ^Apache broken_vary_encoding allow apache access_log /usr/local/squid/var/logs/access.log squid refresh_pattern ^ftp: 1440...
http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin ?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /usr/local/squid/var/logs/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
cache_peer 127.0.0.1 parent 80 0 no-query originserver
#mime_table /usr/local/squid/etc/mime.conf
http_access allow all
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all
http_reply_access allow all
icp_access allow all
#coredump_dir /usr/local/squid/var/cache
cache_dir ufs /var/cache 100 16 256
visible_hostname tjos
error_directory /usr/local/squid/share/errors/Simplify_Chinese
上述配置能够用ie里设置好的代理访问无法实现透明代理
我已经在iptables上做了dnat 把所有的80端口转向 3128 就是不能实现透明代理
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin ?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /usr/local/squid/var/logs/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
cache_peer 127.0.0.1 parent 80 0 no-query originserver
#mime_table /usr/local/squid/etc/mime.conf
http_access allow all
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all
http_reply_access allow all
icp_access allow all
#coredump_dir /usr/local/squid/var/cache
cache_dir ufs /var/cache 100 16 256
visible_hostname tjos
error_directory /usr/local/squid/share/errors/Simplify_Chinese
上述配置能够用ie里设置好的代理访问无法实现透明代理
我已经在iptables上做了dnat 把所有的80端口转向 3128 就是不能实现透明代理
|
你这个应用是部署在网关路由服务器上的吗,特别是那个iptablest的部分?如果不是你就不用想作为透明代理了。
|
透明代理访问需要浏览器身份认证的网页有问题,我也一直没有找到办法,后来不得不放弃了。这里指的是访问时弹出对话框来认证身份的站点,不是一般的表单认证站点。
|
2楼正确, 透明代理重要的一点是要从网关重定向回来. 一般网关都是用路由器较多,