DanP
DanP

Reputation: 6478

Do browsers vary cached content by protocol?

For example, if I have a .js file, will browsers have a seperate cached copy of:

http://www.mysite.com/myfile.js

and

https://www.mysite.com/myfile.js

Or will they only cache a single copy?

Upvotes: 2

Views: 188

Answers (1)

Gumbo
Gumbo

Reputation: 655319

If the URL is different, different resources are assumed. And this fact does also need to be reflected by the cache. So the two URLs in your example will result in two cache entities.

Besides the URL, caches do also take further information of the request and response into account: with the Vary response header field the server can indicate “the set of request-header fields that fully determines […] whether a cache is permitted to use the response to reply to a subsequent request without revalidation.” So it is possible that there are even more than just two cached entities.

Upvotes: 4

Related Questions