the server is nginx, and the following code is configured:
location ~* \.(css|js|apk)$ {
root /usr/local/resources;
expires 12h;
}
using chrome access, you can see that both js and css are from memory cache
and from disk cache
, and then the status is 200
. 50 requests, 1.03 seconds, 17kb
accessing js with firefox is the same as css with 50 requests, but the response is 3.x seconds, 2.x seconds or even 4.x seconds. The returned status is 304
, which does not read the cache as chrome does. The returned content is 1.87MB, which is always like this
firefox request header
Accept: text/css,*/*;q=0.1
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Cache-Control: max-age=0
Connection: keep-alive
Cookie: ID=d450d6f9-434b-4031709a|1548209034|1548208680
Host: x.xxxx.com
If-Modified-Since: Mon, 21 May 2018 01:41:39 GMT
Referer: https://x.xxxx.com/index.html
User-Agent: Mozilla/5.0 (Macintosh; Intel ) Gecko/20100101 Firefox/57.0
firefox response
cache-control: max-age=864000
date: Wed, 23 Jan 2019 02:03:54 GMT
etag: "5b0223d3-37e2"
expires: Sat, 02 Feb 2019 02:03:54 GMT
last-modified: Mon, 21 May 2018 01:41:39 GMT
server: Tengine
set-cookie: SERVERID=3e75f47fc0404902213b8|1548209034|1548208680;Path=/
X-Firefox-Spdy: h2
does firefox need to set anything? Or is there something wrong with the code?