cache-control

How to prevent Browser cache on Angular 2 site?

a 夏天 提交于 2019-11-28 15:17:27
We're currently working on a new project with regular updates that's being used daily by one of our clients. This project is being developed using angular 2 and we're facing cache issues, that is our clients are not seeing the latest changes on their machines. Mainly the html/css files for the js files seem to get updated properly without giving much trouble. angular-cli resolves this brilliantly by providing an --output-hashing flag for the build command. Example usage: ng build --aot --output-hashing=all Bundling & Tree-Shaking provides some details and context. Running ng help build ,

disable caching for specific url in spring security

筅森魡賤 提交于 2019-11-28 14:20:09
in my situation i have four way to solve my problem: write meta config in my index.html and disable caching (doesn't work for me) change index.html to index.jsp and disable caching like here (work for me but my client Group need index.html) using a filter in web.xml and distinguish the desired request and disable caching Spring Security my question is how can i use Spring Security to disable caching for index.html (maybe using intercept-url in http tag) You can selectively add no cache headers to just index.html using Spring Security xml configuartion like this: <security:http> [intercept-url,

Something is forcing responses to have cache-control: private in IIS7

帅比萌擦擦* 提交于 2019-11-28 13:39:16
I have this in my web.config: <system.webServer> <httpProtocol> <customHeaders> <clear /> <add name="Cache-Control" value="max-age=30,public" /> </customHeaders> </httpProtocol> </system.webServer> But when I load the page, this is the response header: Cache-Control: private,max-age=30,public It is an ASP.NET MVC application, the controller has no cache directives specified anywhere. try this <system.web> <httpRuntime sendCacheControlHeader="false" /> </system.web> Let us know how it goes. Jason 来源: https://stackoverflow.com/questions/10908115/something-is-forcing-responses-to-have-cache

How can I programmatically clear cache?

偶尔善良 提交于 2019-11-28 11:35:56
In my application ( ASP.NET + c# ) I need to clear the cache before a user enters an aspx page. Does anybody have any idea how I can programmatically clear the cache on an aspx page, or in the code behind (c#)? Write following code in the page load event: protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); Response.Cache.SetNoServerCaching(); Response.Cache.SetNoStore(); } You can remove a page from the output cache as follows: HttpResponse.RemoveOutputCacheItem("MyPage.aspx"); This won't

Apache: set max-age or expires in .htaccess for directory

家住魔仙堡 提交于 2019-11-28 11:08:58
I have a handful of directories with content which will never change. Is it possible to create .htaccess file which tells the browser that anything in this directory and sub- directories can be cached for a very long time? I would like to copy the same .htaccess file in each directory if possible. If this is possible would you recommend max-age over expires or both? So it does look possible.... the .htaccess file syntax is: Header unset Last-Modified FileETag none ExpiresActive On ExpiresDefault "access plus 1 years" This will turn off Etags and turn on cache-control: max-age Then put this

Chrome browser is not sending if-modified-since header to server

不羁的心 提交于 2019-11-28 08:53:00
I have these headers being sent to the client by the server: Cache-Control:private Connection:keep-alive Content-Encoding:gzip Content-Type:text/html Date:Sun, 27 Nov 2011 11:10:38 GMT ETag:"12341234" Set-Cookie:connect.sid=e1u...7o; path=/; expires=Sun, 27 Nov 2011 11:40:38 GMT; httpOnly Transfer-Encoding:chunked last-modified:Sat, 26 Nov 2011 21:42:45 GMT I want the client to validate that the file hasn't changed on the server and send a "200" if it has otherwise a "304". Firefox sends: if-modified-since: Sat, 26 Nov 2011 21:42:45 GMT if-none-match: "12341234" Why isn't the chrome sending

Force cache refresh after deployment

那年仲夏 提交于 2019-11-28 07:32:30
Is there a way to force a client's cache to reload an HTML file if you can't change the URI referencing that file (e.g., can't add a timestamp param)? Here's my situation: A plugin deployed to a 1000 users That plugin loads example.com/page.html which calls on script.js The resource URI example.com/page.html cannot be changed (w/o plugin updates) page.html has been changed. I need to clear the old page.html from users' cache so the new page.html can load. Any ideas? Htaccess? The PHP API that the old & new page.html call on? Thanks! Well, if the page is already cached by a browser it's

How do you disable caching with WebClient and Windows Phone 7

丶灬走出姿态 提交于 2019-11-28 07:25:45
问题 I am making a call to a REST web service and the mobile app is retrieving the results from its cache and not going to the server. I have seen other suggested fixes (similar issue and similar issue2) but the Cache property is not available in silverlight 4. Does anyone have an idea of how to force silverlight 4 on windows phone 7 to make a request and not hit the cache? 回答1: Although not ideal, a easy solution is to send something like the field "junk" with the value DateTime.Now . That way, a

How to make Microsoft XmlHttpRequest honor cache control directive

混江龙づ霸主 提交于 2019-11-28 07:15:41
i'm issuing a request using MSXML's XmlHttpRequest object: IXMLHttpRequest http = new XmlHttpRequest(); http.open("GET", "http://www.bankofcanada.ca/stat/fx-xml.xml", False, "", ""); http.send(); And the send succeeds, and i get my xml data. Except that XmlHttpRequest didn't actually hit the network (i can see there no actual http request issued). And Process Monitor shows the file is actually being served from my cache: So i want to instruct the XmlHttpRequest user agent that any cached content older than 0 seconds is too old. The standards way to do this is to add a request header: Cache

浏览器缓存机制详解(一)

独自空忆成欢 提交于 2019-11-28 07:09:26
浏览器缓存机制可以极大的提升用户体验,另一方面会因为读取缓存而展示了错误的东西,因而在开发中要设法将其删除。 什么是浏览器缓存? 浏览器缓存就是把一个已经请求过的web资源(如html页面,图片,JS,数据)拷贝一份放在浏览器中。缓存会根据进来的请求保存输入内容的副本。当下一个请求到来的时候,如果是相同的URL,浏览器会根据缓存机制决定是直接使用副本响应访问请求还是向源服务器再次发起请求。 使用缓存的原因 (1)减少网络带宽消耗 当web缓存副本被使用时,只会产生极小的网络流量,可以有效降低运营成本。 (2)降低服务器压力 给网络资源设定有效期之后,用户可以重复使用本地缓存,减少对源服务器的请求,简介降低了对服务器的压力,同时搜索引擎的爬虫机器人也能根据过期机制降低爬取的频率,也能有效降低服务器压力。 (3)减少网络延迟 缓存的使用可以明显加快页面打开速度,达到更好的用户体验。 浏览器的缓存机制 对于浏览器的缓存来讲,这些规则是在HTTP协议头部和HTML页面的Meta标签中定义的。他们分别从新鲜度和校验值两个维度来规定浏览器是否可以直接使用缓存中的副本,还是需要去源服务器获取新版本。 过期机制:指的是缓存副本的有效期。一个缓存的副本必须满足以下条件,浏览器会认为它是有效的,足够新的: 1.含有完整的过期时间控制头信息(HTTP协议报头),并且仍在有效期内 2