免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5689 | 回复: 5
打印 上一主题 下一主题

[proxy] squid反向代理后 cookie有问题,登陆后无法正常退出。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-14 22:54 |只看该作者 |倒序浏览
squid反向代理后  cookie有问题,登陆后无法正常退出。

比如DZ论坛 无法正常退出,是什么原因造成的呢?squid需要怎么设置才能解决?

论坛徽章:
0
2 [报告]
发表于 2008-10-15 09:45 |只看该作者
原帖由 网络 于 2008-10-14 22:54 发表
squid反向代理后  cookie有问题,登陆后无法正常退出。

比如DZ论坛 无法正常退出,是什么原因造成的呢?squid需要怎么设置才能解决?

可以肯定是你的squid设置有问题
:)

论坛徽章:
0
3 [报告]
发表于 2008-10-15 23:35 |只看该作者
原帖由 gogo407 于 2008-10-15 09:45 发表

可以肯定是你的squid设置有问题
:)


这个是我的配置 squid2.6的

http_port 80 vhost vport=80
acl OverConnLimit maxconn 10
http_access deny OverConnLimit
cache_swap_low 30
cache_swap_high 35
maximum_object_size 4096 KB
maximum_object_size_in_memory 4096 KB

cache_dir ufs d:\squid\var\cache 40960 16 256
cache_mem 2048 MB
cache_store_log none
cache_access_log d:\squid\var\logs\access.log
cache_log d:\squid\var\logs\cache.log
error_directory C:\squid\share\errors\Simplify_Chinese
hosts_file c:\WINDOWS\system32\drivers\etc\hosts
emulate_httpd_log on
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
acl QUERY urlpath_regex cgi-bin .html .htm .shtml .shtm .swf
cache deny QUERY

refresh_pattern ^ftp:                1440        20%        10080
refresh_pattern ^gopher:        1440        0%        1440

refresh_pattern -i  cnc.eydns.com 5  50%  5
refresh_pattern -i  www.eydns.com 5  50%  5
refresh_pattern -i  cname.eydns.com 5  50%  5

refresh_pattern -i \.gif$ 5 50% 20 ignore-reload
refresh_pattern -i \.png$ 5 50% 20 ignore-reload
refresh_pattern -i \.jpg$ 5 50% 20 ignore-reload
refresh_pattern -i \.bmp$ 5 50% 20 ignore-reload
refresh_pattern -i \.swf$ 5 50% 20 ignore-reload

#refresh_pattern -i \.wam$ 600 50% 1200 ignore-reload
#refresh_pattern -i \.mp3$ 600 50% 1200 ignore-reload
#refresh_pattern -i \.exe$ 600 50% 1200 ignore-reload
#refresh_pattern -i \.rar$ 600 50% 1200 ignore-reload
#refresh_pattern -i \.zip$ 600 50% 1200 ignore-reload

refresh_pattern -i \.js$   5 50% 20 ignore-reload
refresh_pattern -i \.jsp$  0 50% 20 ignore-reload
refresh_pattern .        0        20%        0


acl all src 0.0.0.0/0.0.0.0
acl p-manager proto cache_object
acl s-localhost src 127.0.0.1/255.255.255.255
acl d-localhost dst 127.0.0.0/8
acl d-domains dstdomain cnc.xx.cn
acl p-safe port 80
acl m-conn method CONNECT
acl m-purge method PURGE
acl n-maxconn maxconn 15
http_access allow p-manager s-localhost
http_access allow m-purge
http_access allow p-manager
http_access allow d-domains
http_access allow  !p-safe
http_access allow n-maxconn
http_access allow all
http_reply_access allow all
acl r-url urlpath_regex realtime
cache deny r-url
icp_access allow all
visible_hostname cnc253
always_direct allow all
cache_mgr admin@xx.com
cache_effective_user squid
cache_effective_group squid
tcp_recv_bufsize 65535 bytes
logfile_rotate 1

论坛徽章:
0
4 [报告]
发表于 2008-10-17 23:54 |只看该作者
顶下!!

论坛徽章:
0
5 [报告]
发表于 2012-08-24 12:12 |只看该作者
ding 上来 需要15字吗

论坛徽章:
0
6 [报告]
发表于 2012-08-26 10:16 |只看该作者
本帖最后由 youzhengchuan 于 2012-08-26 10:18 编辑

和Cookie没有关系,Cookie作为保存在客户端的字节内容,只是通过POST等方式传到服务端的,是不受squid缓存的影响的。

你这样的情况,应该是squid把登陆页面缓存住了导致的。

比如执行和显示登陆页面是 /login.shtml,登陆前和登陆后该页面应该展示不同的内容,但是因为squid缓存住了该页面登陆前的内容,所以导致你登陆后还是看到的该页面还是登陆前的内容。

解决方法:
对于这种不能被squid和用户端缓存的内容,在webserver上应该添加“Cache-Control”头信息,建议设置为“Cache-Control: no-cache”,同时squid上不要忽略server端的“no-cache”指令。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP