Re: [Tails-dev] Server-side caching settings of IDF

Delete this message

Reply to this message
Author: Giorgio Maone
Date:  
To: The Tails public development discussion list
Subject: Re: [Tails-dev] Server-side caching settings of IDF
Hi,

On 29/03/2016 20:23, intrigeri wrote:
>> Should we add "Cache-Control" and "ETag", and remove "Expires"?
> I don't know. I'll look into it later this week.
>
>> $ wget --server-response
>> https://tails.boum.org/install/v1/Tails/i386/stable/latest.yml
>> --2016-03-29 18:06:06--
>> https://tails.boum.org/install/v1/Tails/i386/stable/latest.yml
>> Resolving tails.boum.org (tails.boum.org)... 204.13.164.188
>> Connecting to tails.boum.org (tails.boum.org)|204.13.164.188|:443...
>> connected.
>> HTTP request sent, awaiting response...
>> HTTP/1.1 200 OK
>> Date: Tue, 29 Mar 2016 18:06:08 GMT
>> Server: Apache/2.2.22 (Debian)
>> X-Frame-Options: SAMEORIGIN
>> X-XSS-Protection: 1; mode=block
>> X-Content-Type-Options: nosniff
>> Strict-Transport-Security: max-age=15768000
>> Last-Modified: Fri, 18 Mar 2016 20:43:59 GMT
>> Accept-Ranges: bytes
>> Content-Length: 269
>> Cache-Control: max-age=0
>> Expires: Tue, 29 Mar 2016 18:06:08 GMT
>> Keep-Alive: timeout=15, max=100
>> Connection: Keep-Alive
>> Content-Type: text/plain
>> Content-Language: en
>> Length: 269 [text/plain]
>> Saving to: ‘latest.yml’



I believe that

Cache-control: max-age=0

header, which appears to be already there, actually causes the browser
to revalidate every time, therefore producing an additional hit, even if
the response for unchanged files is a body-empty "304 Not Modified".

Both "max-age" and Expire should reflect your expectation of how long
the IDF is likely to remain valid (1 day? 1 week? 1 month?).

Using ETag is just an alternate way to reduce the network traffic, by
giving the revalidating server another way to tell whether the IDF is
stale other than If-Not-Modified-Since, i.e. If-None-Match, but won't
reduce the validation hits: that's a job for Cache-Control and Expire.

Disclaimer: I'm not a caching guru, but this resource may help
https://www.mnot.net/cache_docs/

Cheers
-- G


--
Giorgio Maone
https://maone.net