summaryrefslogtreecommitdiff
path: root/.sqlx/query-6d34d8232e7247155c697f7ef7a26f6b14e1d30c3fb44ece8fb149c92317fa91.json
diff options
context:
space:
mode:
authorojacobson <ojacobson@noreply.codeberg.org>2025-12-05 20:44:39 +0100
committerojacobson <ojacobson@noreply.codeberg.org>2025-12-05 20:44:39 +0100
commit6cd7e6dd5eb001779a83e9e07c7a3c8379b0548f (patch)
tree39bb7e26fa7c2861394c5602f10d63deef65c70b /.sqlx/query-6d34d8232e7247155c697f7ef7a26f6b14e1d30c3fb44ece8fb149c92317fa91.json
parent9af71a82ca74fde48283d4e0a0adcd69f4fcb9dd (diff)
parenta2285c0e91063cf0f07637664c6055acdcacd9a8 (diff)
Be smarter about browser and proxy server caching for static assets.HEADmain
This covers two things: * For _any_ static asset, send back an `ETag` header based on its content. If the request had an `If-None-Match` header, use that header to instead send back a `Not Modified` response, with no payload, if appropriate, saving the cost of transferring data the client already has. * For _immutable_ static assets, send back a `Cache-Control` header to allow browsers to replay the response from cache, without making a request, for up to 90 days, saving whole HTTP round-trips. In practice, startup time is now dominated by the time needed to check whether the user is logged in, and the time needed to satisfy the `/api/boot` request if they are. "Static" here includes anything that's served in the HTML itself, so things like `/`, `/login`, `/c/:channelid`, and `/me` are all "static," and are all affected by this change even though the logical content of those endpoints also includes data that will vary from user to user and from time to time. All the dynamic data for those responses comes from separate API requests, which don't affect the cacheability of those pages. However, this change is conservative and _does not_ instruct the browser to cache those pages for long periods; it only supports telling the browser that the cached copy they have is fine, via a `Not Modified` response. This change also includes a minimum Rust version bump, to the recently-released 1.91 - as it uses `Duration::from_hours` to compute the `Cache-Control` header. I could use `Duration::new` or `Duration::from_secs`, but really, working in increments of days from such tiny units is awkward. I'd prefer to use `Duration::from_days`, but it's not stable yet. Merges asset-etags into main.
Diffstat (limited to '.sqlx/query-6d34d8232e7247155c697f7ef7a26f6b14e1d30c3fb44ece8fb149c92317fa91.json')
0 files changed, 0 insertions, 0 deletions