[openstreetmap/openstreetmap-website] Last-Modified header missing from almost all Website Static Files (#2260)

alexkemp9 notifications at github.com
Sun Jun 16 17:10:05 UTC 2019


Conducting a simple refresh (f5) on a recently downloaded [test map page](https://www.openstreetmap.org/way/17236956) causes only half (10 out of 21) of the files to give a `304 Not Modified`. That is obviously *Not Good* both for the user (slow) plus OSM (increased bandwidth + load). There is no single reason for that cache-miss, so I will raise a separate issue for each file-type.

There *is* an across-the-board issue that affects almost all website files: almost no files contain a `Last-Modified` Response Header, in spite of the RFC advice + current best-practice from Apache.

[Section 13.3.4 of the HTTP/1.1 rfc2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.3.4) advises the following:

> ***13.3.4 Rules for When to Use Entity Tags and Last-Modified Dates***
>> In other words, the preferred behavior for an HTTP/1.1 origin server is to send both a strong entity tag and a Last-Modified value.
>> HTTP/1.0 clients and caches will ignore entity tags. Generally, last-modified values received or used by these systems will support transparent and efficient caching, and so HTTP/1.1 origin servers should provide Last-Modified values. In those rare cases where the use of a Last-Modified value as a validator by an HTTP/1.0 system could result in a serious problem, then HTTP/1.1 origin servers should not provide one.

Although RFC2616 has been updated, I am unaware of any change to the above advice.

The only downside that I am aware of is when dealing with a HTTP/1.0 Proxy which may respond to a `Last-Modified` which conflicts with the `Etag`. I suspect that that is rarer than hen's teeth. Nevertheless, above is the relevant advice.

I've seen that up to at least [29 Jul 2013](https://github.com/openstreetmap/openstreetmap-website/commit/2d5df687fcbf2564e2f199535aed04f67953bd0e) that files *were* supplied with a `Last-Modified` header. I could not find any reason why that was removed and the fact that Apache always provides both for files directly under it's control convinces. I'm a belt 'n' braces kind of man myself & it seems to me that providing a `Last-Modified` still fits with "Do no harm".

Please also look at this [Diary page](https://www.openstreetmap.org/user/alexkemp/diary/368814) for fuller comments.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2260
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190616/2a37ca4f/attachment.html>


More information about the rails-dev mailing list