perf: gzip-vangnet in nginx voor geproxyde responses (v0.3.82-beta)
All checks were successful
dev - build & deploy naar test / build-and-deploy (push) Successful in 1m4s

- gzip on + gzip_proxied any (zonder die laatste comprimeert nginx geproxyde responses helemaal niet) + gzip_vary + min_length 1024 voor css/js/json/svg/tekst
- Geen dubbele compressie: responses die al Content-Encoding dragen (brotli/gzip uit de app) laat nginx ongemoeid; dit vangt alleen wat de app mist
- Cache-beleid blijft bewust op één plek (de app), zodat lokaal en productie identiek gedragen
- Configtest erbij in security-config-stijl

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0149FgUQvuwxKKEdvQGmNngF
This commit is contained in:
Ramon 2026-07-16 19:02:53 +02:00
parent 456d664718
commit 2fff8a3aa5
4 changed files with 19 additions and 2 deletions

View file

@ -1 +1 @@
0.3.81-beta
0.3.82-beta

View file

@ -12,6 +12,16 @@ server {
# Wat groter zodat grote borden/afbeeldingen niet geweigerd worden
client_max_body_size 55m;
# Gzip-vangnet: de app comprimeert zelf al (brotli/gzip via @fastify/compress)
# en nginx comprimeert nooit dubbel (responses mét Content-Encoding blijven
# ongemoeid) - dit vangt alleen wat de app mist. Let op: zonder
# gzip_proxied comprimeert nginx geproxyde responses helemaal niet.
gzip on;
gzip_proxied any;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/css application/javascript application/json image/svg+xml text/plain;
location / {
proxy_pass http://app:3000;
proxy_http_version 1.1;

View file

@ -2,7 +2,7 @@
"use strict";
/* version shown until /api/version resolves (or if the fetch fails, e.g. offline).
Kept in sync by hand with the VERSION file at the repo root on every release. */
const VERSION = "0.3.81-beta";
const VERSION = "0.3.82-beta";
(function(){
const tag = document.getElementById("verTag");
tag.textContent = "v"+VERSION;

View file

@ -15,6 +15,13 @@ test('nginx behoudt het publieke forwarded protocol', async () => {
assert.match(nginx, /X-Forwarded-Proto \$teach_forwarded_proto/);
});
test('nginx comprimeert geproxyde responses als vangnet', async () => {
const nginx = await readFile('deploy/nginx.conf', 'utf8');
/* zonder gzip_proxied comprimeert nginx geproxyde responses helemaal niet */
assert.match(nginx, /gzip_proxied any/);
assert.match(nginx, /gzip_vary on/);
});
test('client bewaart geen bearer-token meer', async () => {
const core = await readFile('public/js/core.js', 'utf8');
assert.doesNotMatch(core, /headers\.Authorization|localStorage\.setItem\("teach\.token"/);