openml / openml.org

New OpenML website
https://new.openml.org
BSD 3-Clause "New" or "Revised" License
25 stars 18 forks source link

Extend cache-control's max-age for `main.HASH.js` #307

Open PGijsbers opened 1 year ago

PGijsbers commented 1 year ago

It looks like we use URL-based caching for the main javascript file, based on the fact that the name contains a hash and the HTTP header contains a set max-age:

C:\Users\Pieter>curl  -I https://www.openml.org/static/js/main.27ea998a.js
HTTP/1.1 200 OK
Date: Mon, 22 May 2023 20:58:21 GMT
Server: gunicorn/20.0.4
Content-Length: 2130393
Content-Type: application/javascript; charset=utf-8
Last-Modified: Wed, 03 May 2023 17:30:58 GMT
Cache-Control: public, max-age=43200
Expires: Tue, 23 May 2023 08:58:21 GMT
ETag: "1683135058.0947442-2130393-3808763291"
Accept-Ranges: bytes
Access-Control-Allow-Origin: *

Why then is the max-age only set to 12 hours? It is my understanding that with this setup, invalidation should happen by updating the HTML page to reference a different javascript file. The max-age can then be set to something much larger (a month or year), so that conceivably there is never a cache validation round trip explicitly for the javascript file. Updating the max-age will result in viewer round trips which lightens server load and gives the user a faster experience.