Skip to content

Commit 17ded44

Browse files
Add cache headers to nginx config
Browsers were heuristically caching the site and the compiled /output modules because no Cache-Control header was sent; with files dating from a 2023 deploy, cached clients could be considered fresh for months. no-cache makes browsers revalidate via ETag: unchanged files cost a 304, changed files are re-downloaded immediately. Matches the configuration applied to the live server on 2026-07-05. Also updates the changelog entries to reference this PR.
1 parent 8a21507 commit 17ded44

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ New features:
1111
Bugfixes:
1212

1313
Other improvements:
14-
- Bump the Stackage resolver from `lts-20.9` to `lts-20.26` (GHC 9.2.5 → 9.2.8), the newest snapshot compatible with `purescript-0.15.15` (#320 by @thomashoneyman)
15-
- Modernize the server build: `cabal-version: 2.4`, build with `-Wall -Werror` (with attendant cleanup in `server/Main.hs`), remove unused dependencies and the redundant `Setup.hs` (#320 by @thomashoneyman)
16-
- Speed up CI server builds by removing the `-j1` limit; runners have had 4 vCPUs and 16GB of RAM for years (#320 by @thomashoneyman)
14+
- Bump the Stackage resolver from `lts-20.9` to `lts-20.26` (GHC 9.2.5 → 9.2.8), the newest snapshot compatible with `purescript-0.15.15` (#322 by @thomashoneyman)
15+
- Modernize the server build: `cabal-version: 2.4`, build with `-Wall -Werror` (with attendant cleanup in `server/Main.hs`), remove unused dependencies and the redundant `Setup.hs` (#322 by @thomashoneyman)
16+
- Speed up CI server builds by removing the `-j1` limit; runners have had 4 vCPUs and 16GB of RAM for years (#322 by @thomashoneyman)
17+
- Serve the site and the compiled `/output` modules with `Cache-Control: no-cache` so browsers revalidate via ETag instead of heuristically caching a stale client for months after a deploy (#322 by @thomashoneyman)
1718

1819
## [v2026-07-05.1](https://github.com/purescript/trypurescript/releases/tag/v2026-07-05.1)
1920

deploy/nginx.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ server {
4444

4545
location / {
4646
root /var/www/trypurescript/public;
47+
# Always revalidate (cheap ETag 304s): the HTML references the bundle by
48+
# a fixed name, so without this browsers heuristically cache the site
49+
# and can serve a stale client for months after a deploy.
50+
add_header Cache-Control "no-cache";
4751
}
4852

4953
}
@@ -86,6 +90,10 @@ server {
8690
# match to ensure that we only serve JS files.
8791
location ~ ^/output/(.+\.js)$ {
8892
add_header Access-Control-Allow-Origin *;
93+
# Module URLs are generated by the compiler and change content when the
94+
# package set or compiler changes; revalidate so browsers never mix
95+
# modules from different deploys.
96+
add_header Cache-Control "no-cache";
8997
alias /var/www/trypurescript/staging/.psci_modules/$1;
9098
}
9199
}

0 commit comments

Comments
 (0)