Skip to content

improved caching for superevent files on the web

Alexander Pace requested to merge cache-apiweb into master

Link cache-control: max-age for superevent files to the public page's max-age. Note that this only affects files from /apiweb/, which gets displayed on the web, and not /api/, which is what is accessed by the client code.

The public page now caches for five minutes by default. Unfortunately the images on that page are still controlled by the global cache (60s), so they still get pulled requested at a higher rate than the page itself. For example, this skymap image from /api/superevents/... is dictated by the global cache age on gracedb-dev1:

Screen_Shot_2023-07-18_at_8.49.36_PM

But with this patch, the same image, but accessed through /apiweb/superevents/... shows a max-age of 300s (the default for the public page) and the http status code shows 304, which means it's a cached copy:

Screen_Shot_2023-07-18_at_8.48.24_PM

And those changes are being shown on gracedb-dev1's public page:

Screen_Shot_2023-07-18_at_8.50.45_PM

Merge request reports