4 ms·
This is a fundamental property of caching. To avoid an extra fetch, you have to explicitly tell the data source that you already have this piece of data, and s
by nine_k 7y ago
This is a fundamental property of caching.
To avoid an extra fetch, you have to explicitly tell the data source that you already have this piece of data, and sending it is not required.
- jchw 7y agoEtags make it really easy though, by storing not a hash, but arbitrary text. Of course arbitrary text is much more flexible. Even without etags you could devise a similar scheme probably, if you can get a browser to cache a request indefinitely. Then no request would need to be made to get the “cookie,” though JS would be needed to make use of it.
- pornel 7y agoSame tracking is possible by embedding data in last-modified/if-modified-since, or location of cacheable redirects. There are also other variations that just use resource bodies, e.g. cache HTML that opens an iframe with a unique URL, JS that contains constants storing data, CSS that opens user-specific URLs via imports, etc. For tracking you just need any unique identifier, so (lack of) flexibility doesn't do much. You can even track users with HSTS cache that caches only 1 bit per domain.
- nfoz 7y agoIs there a way to design the http cache so that this is not true? One way is for clients to first ask for the latest checksum/Etag from the server, and compare it to what they have locally before requesting the resource. But maybe that's an extra round-trip. I wonder if a different design of HTTP could have avoided all this.
- icebraining 7y agoUsing Subresource Integrity, the server can tell the browser about the latest checksum without having an extra round-trip.
- nine_k 7y agoNo, there us no way around it. Either a page requests a linked resource, or not. If it does not, we can assume that it has it cached. We can tell these two outcomes apart. But we can make tracking much harder by not having the client send an ETag. E.g. the server could send ETags of all page's resources in the initial response, and let the client decide. This assumes that the server knows about all the related resources, about the page structure, etc. This is not unreasonable, but this does special-case HTML, and does complicate the server quite significantly.
- orf 7y agoSubresource integrity solves this issue.