etag

IE 9+ ignores ETag value change and returns cached response

有些话、适合烂在心里 提交于 2019-12-03 12:36:59
The Etag provided cache validation that works well with FF & chrome, but IE seems to ignore the Etag value and always returns the cached response. The server response is: HTTP/1.1 200 OK Date: Mon, 07 Jul 2014 06:01:57 GMT Content-Type: application/json ETag: a7628382056ddd13b7e06991571fd3ad Content-Encoding: gzip Content-Length: 4360 when client sends a conditional get request If-None-Match: 71fb49ecd6f85545693dec0e78ae2131 The request is not sent at all and IE returns the cached response. It transparent when ETag value is the same but a problem when ETag is different. The only solution that

Is there a Ruby http client library with a response cache?

↘锁芯ラ 提交于 2019-12-03 11:31:30
问题 Is there a Ruby http client library where responses are automatically cached by ETag and the If-Non-Match header applied to requests on previously used URLs? 回答1: You might want to check the list of "Ruby HTTP clients features" (archived version from January 2015) for a complete overview. 回答2: Take a look at Faraday-HTTP-Cache. 回答3: rufus-jig supports conditional GET. 来源: https://stackoverflow.com/questions/6104922/is-there-a-ruby-http-client-library-with-a-response-cache

How do you make an etag that matches Apache?

懵懂的女人 提交于 2019-12-03 09:17:13
问题 I want to make an etag that matches what Apache produces. How does apache create it's etags? 回答1: Apache uses the standard format of inode-filesize-mtime. The only caveat to this is that the mtime must be epoch time and padded with zeros so it is 16 digits. Here is how to do it in PHP: $fs = stat($file); header("Etag: ".sprintf('"%x-%x-%s"', $fs['ino'], $fs['size'],base_convert(str_pad($fs['mtime'],16,"0"),10,16))); 回答2: One thing to remember about Apache's Etags is that they don't play well

304 Not Modified When If-None-Match is valid

≯℡__Kan透↙ 提交于 2019-12-03 08:04:49
I am optimizing an Express JSON API for consumption by iOS & Android Apps and do not seem to be able to get Express to respond with the correct 304 header when the Apps specify an etag within the If-None-Match header. I needn't setup Etag generation as Express was already providing those; however when the Apps specify that etag again in a second request; Express' response is still a 200 with the data, as you can see in my tests in Postman: How can I enable this functionality? Update: The iOS dev is seeing the correct 304 Not Modified responses from the Express server but I don't understand why

(Weak) ETags and Last-Modified

£可爱£侵袭症+ 提交于 2019-12-03 07:56:25
问题 As far as I understand the specs, the ETag, which was introduced in RFC 2616 (HTTP/1.1) is a successor (of sorts) for the Last-Modified-Header, which is proposet to give the software-architect more controll over the cache-revalidating process. If both Cache-Validation-Headers (If-None-Match and If-Modified-Since) are present, according to RFC 2616, the client (i.e. the browser) should use the ETag when checking, if a resource has changed. According to section 14.26 of RFC 2616, the server

Etags and last-modified over https SSL?

£可爱£侵袭症+ 提交于 2019-12-03 06:36:44
Is it possible to use HTTP caching for conditional GET requests over a secure HTTPS connection? I've got caching working over non-secure HTTP, but when I switch to HTTPS the browser stops sending if-none-match and if-modified-since headers, so the caching breaks. I've tried various Cache-Control settings like public, max-age=3600 and whatnot, no dice. This happens in both Safari and Chrome, so I'm assuming the SSL is breaking it somehow. Is caching not allowed over SSL? And just to be clear, the server is indeed properly setting the etag and last-modified headers, but the browser is not

How to configure ETag on Nginx

强颜欢笑 提交于 2019-12-03 04:15:51
问题 I'm using Nginx as a webserver and want to implement a browser caching method so that the users keep copies of static unchanged files locally and download only changed files. One of the propositions was to use the files timestamp to figure out the changed files and refresh them only, but this is not possible in my case since after every new deploy a new version of the whole web application is created and all the files' timestamps change. I researched a little about the ETag header, and it

Rails - etags vs. page caching (file cache)

戏子无情 提交于 2019-12-03 03:03:44
What would be some advantages of using etags/stale?/fresh_when? instead of page caching (on a file cache)? Apache automatically handles etags for static files, but even if it didn't, page caching would still be better since the Rails app doesn't even get called. So, in what instances would I use the methods provided by Rails (stale?/fresh_when?)? They are really complimentary. Etags/fresh_when etc. help you play nice with downstream caches (like your own Varnish/Squid instances or Rack::Cache or the Browser cache or ISP Proxy Servers…) Page caching saves you from hitting your rails stack

Is there a Ruby http client library with a response cache?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 01:54:02
Is there a Ruby http client library where responses are automatically cached by ETag and the If-Non-Match header applied to requests on previously used URLs? You might want to check the list of " Ruby HTTP clients features " (archived version from January 2015) for a complete overview. Take a look at Faraday-HTTP-Cache . rufus-jig supports conditional GET. 来源: https://stackoverflow.com/questions/6104922/is-there-a-ruby-http-client-library-with-a-response-cache

前端优化

懵懂的女人 提交于 2019-12-03 01:44:06
前言 基本HTML加载,需要 20ms 左右 Nginx配置,关闭 keepalive、etag、gzip、if_modified_since 协议:HTTP/1.1 浏览器:Chrome 减少HTTP请求 加载未合并外部css,需要 35ms 左右 加载合并外部css,需要 25ms 左右 两个合并后的css,加载减少了10ms,如果将页面所有的css、js、图片(CSS sprites )合并,减少的时间将很可观。 DOM以及CSS 上图是浏览器解析HTML和渲染树之间的流程。浏览器在获取到HTML页面后开始解析页面,解析到head标签后,发现外部CSS,会异步发出请求,CSS获取后,解析CSS。 HTML解析后生成DOM Tree,CSS解析后生成CSSOM Tree, 两者结合开始渲染树。 1、首屏的页面要快速的渲染出来,CSS最好放在页面头部。同时有多个css文件的时候,也要将基本样式放在其他样式之前加载(边获取边渲染)。 2、HTML以及CSS的元素层级要尽量少,加快页面渲染。 3、对于首页,可以将基本样式内联放在头部。(快速渲染,灵活应用) JS 上图是浏览器解析流程,蓝色是样式解析,黄色是JS脚本执行,顺序执行。JS脚本执行会阻塞样式或DOM解析 1、JS脚本放在页面下面,防止阻塞页面渲染。 2、不要在JS里执行长时间的程序。 3、减少JS对DOM的操作