nixpkgs/pkgs/servers/http
aszlig ccf55bead1
nginx: Clear Last-Modified if ETag is from store
This is what I've suspected a while ago[1]:

> Heads-up everyone: After testing this in a few production instances,
> it seems that some browsers still get cache hits for new store paths
> (and changed contents) for some reason. I highly suspect that it might
> be due to the last-modified header (as mentioned in [2]).
>
> Going to test this with last-modified disabled for a little while and
> if this is the case I think we should improve that patch by disabling
> last-modified if serving from a store path.

Much earlier[2] when I reviewed the patch, I wrote this:

> Other than that, it looks good to me.
>
> However, I'm not sure what we should do with Last-Modified header.
> From RFC 2616, section 13.3.4:
>
> - If both an entity tag and a Last-Modified value have been
>   provided by the origin server, SHOULD use both validators in
>   cache-conditional requests. This allows both HTTP/1.0 and
>   HTTP/1.1 caches to respond appropriately.
>
> I'm a bit nervous about the SHOULD here, as user agents in the wild
> could possibly just use Last-Modified and use the cached content
> instead.

Unfortunately, I didn't pursue this any further back then because
@pbogdan noted[3] the following:

> Hmm, could they (assuming they are conforming):
>
>  * If an entity tag has been provided by the origin server, MUST
>    use that entity tag in any cache-conditional request (using If-
>    Match or If-None-Match).

Since running with this patch in some deployments, I found that both
Firefox and Chrome/Chromium do NOT re-validate against the ETag if the
Last-Modified header is still the same.

So I wrote a small NixOS VM test with Geckodriver to have a test case
which is closer to the real world and I indeed was able to reproduce
this.

Whether this is actually a bug in Chrome or Firefox is an entirely
different issue and even IF it is the fault of the browsers and it is
fixed at some point, we'd still need to handle this for older browser
versions.

Apart from clearing the header, I also recreated the patch by using a
plain "git diff" with a small description on top. This should make it
easier for future authors to work on that patch.

[1]: https://github.com/NixOS/nixpkgs/pull/48337#issuecomment-495072764
[2]: https://github.com/NixOS/nixpkgs/pull/48337#issuecomment-451644084
[3]: https://github.com/NixOS/nixpkgs/pull/48337#issuecomment-451646135

Signed-off-by: aszlig <aszlig@nix.build>
2019-12-30 14:30:36 +01:00
..
apache-httpd apacheHttpd: 2.4.39 -> 2.4.41 2019-08-18 17:40:26 -04:00
apache-modules Merge pull request #70365 from jglukasik/mod_tile 2019-11-05 20:45:55 -05:00
apt-cacher-ng treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
couchdb Merge branch 'master' into staging-next 2019-08-24 08:55:37 +02:00
darkhttpd treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
gatling treewide: name -> pname 2019-08-17 10:54:38 +00:00
h2o h2o: build with openssl 2019-12-21 22:55:58 +00:00
hiawatha maintainer-list.nix: remove ndowens 2019-12-26 16:47:41 -05:00
hyp
jboss
jetty jetty: 9.4.22.v20191022 -> 9.4.24.v20191120 (#74417) 2019-11-30 22:03:40 +01:00
lighttpd Re-Revert "Merge branch 'staging-next'" 2019-09-22 09:38:09 +02:00
lwan treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
micro-httpd treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
mini-httpd
myserver treewide: name -> pname 2019-08-17 10:54:38 +00:00
nginx nginx: Clear Last-Modified if ETag is from store 2019-12-30 14:30:36 +01:00
nix-binary-cache treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
openresty openresty: 1.15.8.1 -> 1.15.8.2 2019-09-27 16:17:19 -07:00
pshs treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
redstore
showoff
spawn-fcgi treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
tengine tengine: 2.3.1 -> 2.3.2 (#70574) 2019-10-15 22:00:09 +02:00
thttpd treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
tomcat treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
unit unit: update build configuration 2019-11-24 12:55:21 +03:00
webfs treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
webhook treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00
yaws treewide: name -> pname (easy cases) (#66585) 2019-08-15 13:41:18 +01:00