A proxy server does not parse the html pages, so it is a bad idea to embed the cache control inside the html pages. You need to send those headers in your server-side code, like this in ASP:
<%
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>or you can set up the web server to send out those headers automatically
<%
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>or you can set up the web server to send out those headers automatically
我觉得你说的有理, 我也觉得proxy 应该不会分析HTML中的内容, 太复杂了.
但是我现在没用asp, 还有别的办法吗?
但我点进去看, 仍然是以前的,怎么刷新也不管用.我换了一个proxy, (我们单位有两个proxy), 那个proxy没有配cache, 所以立即就更新了.是什么东西控制proxy是缓存页面还是不缓存呢?
我用jsp的时候发现HTML的协议中(不是在页面中) 有JSESSION=...之类的东西, proxy就不缓存了.
sina的评论也没用jsp,没有JSESSION之类的东西, 是通过什么达到不缓存的呢?
# enable the proxy server:
#
#<IfModule mod_proxy.c>
# ProxyRequests On# <Directory proxy:*>
# Order deny,allow
# Deny from all
# Allow from mengxianhui
# </Directory> #
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
# ProxyVia On #
# To enable the cache as well, edit and uncomment the following lines:
# (no cacheing without CacheRoot)
#
# CacheRoot "D:/web/Apache/proxy"
# CacheSize 5
# CacheGcInterval 4
# CacheMaxExpire 24
# CacheLastModifiedFactor 0.1
# CacheDefaultExpire 1
# NoCache a-domain.com another-domain.edu joes.garage-sale.com#</IfModule>
# End of proxy directives.
Cache-Control: No-cache如何设置要具体看所用的WEB server了.
如果是IIS, 可以参考www.microsoft.com
How to Modify the Cache-Control HTTP Header When You Use IIS (Q247404)问题基本解决了, 谢谢各位