I have a website which contains some resource like css and javascript. However some resources are cached in browser while other not.
For example, I checked 2 resource URLs:
The second one looks good, next request is 304 once it's cached in browser, with first request, the request always is 200, I think that it's not cached in client.
Thumbnail for not cached resource
Thumbnail for caching resource
Anyone please help to debug and give me the suggestion
I am by no means an expert, but after looking at both response headers, it look like the only notable differences between the two is that you send the first one (the one that isn't cached) using Transfert-encoding: chunked. And it looks like a file can only be cached if content-length is provided.
You should try to specify a length for your document, I think it will do the trick.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.