cache-control

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

ぐ巨炮叔叔 提交于 2019-11-27 05:14:20
问题 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

HTTP协议缓存

左心房为你撑大大i 提交于 2019-11-27 05:00:58
缓存的概念 缓存这个东西真的是无处不在, 有浏览器端的缓存, 有服务器端的缓存,有代理服务器的缓存, 有ASP.NET页面缓存,对象缓存。 数据库也有缓存, 等等。 http中具有缓存功能的是浏览器缓存,以及缓存代理服务器。 http缓存的是指:当Web请求抵达缓存时, 如果本地有“已缓存的”副本,就可以从本地存储设备而不是从原始服务器中提取这个文档。 缓存的好处 缓存的好处是显而易见的, 好处有, 1. 减少了冗余的数据传输,节省了网费。 2. 减少了服务器的负担, 大大提高了网站的性能 3. 加快了客户端加载网页的速度 Fiddler可以方便地查看缓存的header Fiddler中把header都分门别类的放在一起,这样方便查看。 如何判断缓存新鲜度 Web服务器通过2种方式来判断浏览器缓存是否是最新的。 第一种, 浏览器把缓存文件的最后修改时间通过 header ”If-Modified-Since“来告诉Web服务器。 第二种, 浏览器把缓存文件的ETag, 通过header "If-None-Match", 来告诉Web服务器。 通过最后修改时间, 来判断缓存新鲜度 1. 浏览器客户端想请求一个文档, 首先检查本地缓存,发现存在这个文档的缓存, 获取缓存中文档的最后修改时间,通过: If-Modified-Since, 发送Request给Web服务器。 2.

how to set up both httpexpires and cachecontrol headers

不想你离开。 提交于 2019-11-27 04:52:02
问题 I want to set up both expires and cachecontrol and httpExpires headers in web.config by following the answer on that question What's the difference Expires and Cache-control:max-age? <system.webServer> <staticContent> <clientCache cacheControlCustom="public" cacheControlMaxAge="12:00:00" cacheControlMode="UseMaxAge" /> <clientCache cacheControlCustom="public" httpExpires="Tue, 19 Jan 2038 03:14:07 GMT" cacheControlMode="UseExpires" /> </staticContent> </system.webServer> But for some reason

Is Chrome ignoring Cache-Control: max-age?

瘦欲@ 提交于 2019-11-27 03:39:07
Background: IIS 7 AspNet 3.5 web app Chrome dev tools lists 98 requests for the home page of the web app (aspx + js + css + images). In following requests, status code is 200 for css/images files. No cache info, browser asks server each time if file has to be updated. OK. In IIS 7 I set HTTP header for cache control, set to 6 hours for the "ressources" folder. In Chrome, using dev tools, I can see that header is well set in response: Cache-Control: max-age=21600 But I still get 98 requests... I thought that browser should not request one ressource if its expiration date is not reached, and I

How can I programmatically clear cache?

你说的曾经没有我的故事 提交于 2019-11-27 03:35:01
问题 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#)? 回答1: 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(); } 回答2: You can

Force cache refresh after deployment

丶灬走出姿态 提交于 2019-11-27 01:56:06
问题 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

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

故事扮演 提交于 2019-11-27 01:22:28
问题 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 //

Make IE to cache resources but always revalidate

主宰稳场 提交于 2019-11-26 23:51:07
The cache control header "no-cache, must-revalidate, private" allows browsers to cache the resource but forces a revalidate with conditional requests. This works as expected in FF, Safari, and Chrome. However, IE7+8 does not send a conditional request, that is, "If-Modified-Since" is missing in the request header and hence the server responds with HTTP/200 instead of HTTP/304. Here are the full server response headers: Last-Modified: Wed, 16 Feb 2011 13:52:26 GMT Content-type: text/html;charset=utf-8 Content-Length: 10835 Date: Wed, 16 Feb 2011 13:52:26 GMT Connection: keep-alive Cache-Control

Retrofit - Okhttp client How to cache the response

一曲冷凌霜 提交于 2019-11-26 22:34:49
问题 I'm trying to cache the response of http calls done by Retrofit(v 1.9.0) with OkHttp(2.3.0). It always made the network calls if I try to make a call without internet then java.net.UnknownHostException . RestClient public class RestClient { public static final String BASE_URL = "http://something.example.net/JSONService"; private com.ucc.application.rest.ApiService apiService; public RestClient() { Gson gson = new GsonBuilder() .setDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'") .create()

Preventing cache on back-button in Safari 5

大憨熊 提交于 2019-11-26 20:27:01
As of recent safari 5 was released, and it turns out to cause some problems for my website. I have a dynamic website running classic ASP (though that shouldn't matter much) and the site has some creative use of the history stack. For instance, you can be on a page that lists products, then go to details about a product and change the product (admin-view). When you click save on the product the information is sent to the server via AJAX, and a history.back() is issued. This works great in all browsers (including safari <= 4), however, in the newly released safari 5 it stopped working. It seems