cache-control

Cache-control: no-store, must-revalidate not sent to client browser in IIS7 + ASP.NET MVC

本小妞迷上赌 提交于 2019-11-28 06:49:22
I am trying to make sure that a certain page is never cached, and never shown when the user clicks the back button. This very highly rated answer (currently 1068 upvotes) says to use : Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); Response.AppendHeader("Pragma", "no-cache"); Response.AppendHeader("Expires", "0"); However in IIS7 / ASP.NET MVC, when I send those headers then the client sees these response headers instead: Cache-control: private, s-maxage=0 // that's not what I set them to Pragma: no-cache Expires: 0 What happened to the cache-control header?

Howto deactivate caching inside a jsp page

折月煮酒 提交于 2019-11-28 04:52:44
问题 I understand there is a HTTP response header directive to disable page caching: Cache-Control:no-cache I can modify the header by "hand": <%response.addHeader("Cache-Control","no-cache");%> But is there a "nice" way to make the JSP interpreter return this header line in the server response? (I checked the <%@page ...%> directive. It seems there is nothing like that.) 回答1: Also add response.addHeader("Expires","-1"); response.addHeader("Pragma","no-cache"); to your headers and give that a shot

Caching effect on CORS: No 'Access-Control-Allow-Origin' header is present on the requested resource

廉价感情. 提交于 2019-11-28 03:55:11
The short version of this issue is we are seeing the typical CORS error ( x has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. ) however we are absolutely sending the specified headers. The requests are fine to begin with however after n (pattern undetermined) amount of time SOME (no real pattern to this other than it's a random 1 or 2 assets referenced in the html file) requests will suddenly start failing. On a hard refresh or with disabling cache, the issue is resolved. We're wondering how caching may affect CORS in this case? Or

How to prevent content being displayed from Back-Forward cache in Firefox?

早过忘川 提交于 2019-11-27 23:05:47
Browser: Firefox 6.0 I've Page A with the following setup to make sure the content is NOT stored in the bfcache of the browser: 1) $(window).unload(function(){}); 2) Following HTTP headers: <meta http-equiv="pragma" content="no-cache" /> <meta http-equiv="expires" content="-1" /> <meta http-equiv="cache-control" content="no-cache"/> I've also hooked up the events pagehide and pageshow . When I am navigating away from the page, pagehide is invoked with CORRECT value for the event property persisted = false (that is what needed: no persistence in cache!) After navigating a couple of pages, I've

Google Chrome does not revalidate etag on back/forth

懵懂的女人 提交于 2019-11-27 20:46:42
问题 Even though I send "cache-control: must-revalidate" Google Chrome uses a locally cached page when using the back and forth button in the browser. This is part of the original response: HTTP/1.1 200 OK cache-control: private, must-revalidate etag: "c9239b5d4b98949f8469a05062e05bb999d7512e" Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 If I refresh the page I get a "HTTP/1.1 304 Not Modified" response but when I use the back button I get the

Why does Browser still sends request for cache-control public with max-age?

你。 提交于 2019-11-27 20:24:19
I have Amazon S3 objects, and for each object, I have set Cache-Control: public, max-age=3600000 That is roughly 41 days. And I have Amazon CloudFront Distribution set with Minimum TTL also with 3600000. This is the first request after clearing cache. GET /1.0.8/web-atoms.js HTTP/1.1 Host: d3bhjcyci8s9i2.cloudfront.net Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 And

Private vs Public in Cache-Control

[亡魂溺海] 提交于 2019-11-27 19:48:00
问题 Can you please describe an example indicating difference between Public and Private Cache-Control in asp.net applications hosted in IIS. I read in MSDN that the difference is the following: Public: Sets Cache-Control: public to specify that the response is cacheable by clients and shared (proxy) caches. Private: Default value. Sets Cache-Control: private to specify that the response is cacheable only on the client and not by shared (proxy server) caches. I am not sure I have completely

How to prevent Browser cache on Angular 2 site?

假装没事ソ 提交于 2019-11-27 19:43:30
问题 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. 回答1: angular-cli resolves this brilliantly by providing an --output-hashing flag for the build command. Example usage: ng build -

Add Cache-Control and Expires headers to Azure Storage Blobs

戏子无情 提交于 2019-11-27 18:31:18
I'm using Azure Storage to serve up static file blobs but I'd like to add a Cache-Control and Expires header to the files/blobs when served up to reduce bandwidth costs. Application like CloudXplorer and Cerebrata's Cloud Storage Studio give options to set metadata properties on containers and blobs but get upset when trying to add Cache-Control. Anyone know if it's possible to set these headers for files? I had to run a batch job on about 600k blobs and found 2 things that really helped: Running the operation from a worker role in the same data center. The speed between Azure services is

彻底弄懂HTTP缓存机制及原理

谁说胖子不能爱 提交于 2019-11-27 18:05:55
彻底弄懂HTTP缓存机制及原理 转载于云中桥 前言 Http 缓存机制作为 web 性能优化的重要手段,对于从事 Web 开发的同学们来说,应该是知识体系库中的一个基础环节,同时对于有志成为前端架构师的同学来说是必备的知识技能。 但是对于很多前端同学来说,仅仅只是知道浏览器会对请求的静态文件进行缓存,但是为什么被缓存,缓存是怎样生效的,却并不是很清楚。 在此,我会尝试用简单明了的文字,像大家系统的介绍HTTP缓存机制,期望对各位正确的理解前端缓存有所帮助。 在介绍HTTP缓存之前,作为知识铺垫,先简单介绍一下HTTP报文 HTTP报文就是浏览器和服务器间通信时发送及响应的数据块。 浏览器向服务器请求数据,发送请求(request)报文;服务器向浏览器返回数据,返回响应(response)报文。 报文信息主要分为两部分 1.包含属性的首部(header)--------------------------附加信息(cookie,缓存信息等) 与缓存相关的规则信息,均包含在header中 2.包含数据的主体部分(body)-----------------------HTTP请求真正想要传输的部分 缓存规则解析 为方便大家理解,我们认为浏览器存在一个缓存数据库,用于存储缓存信息。 在客户端第一次请求数据时,此时缓存数据库中没有对应的缓存数据,需要请求服务器,服务器返回后