Files
nixos/modules/server
oqyude d9c56746a1 fix(nginx): exempt herdr-web-ui /api/auth and /api/devices/pair from authelia
The herdr-web-ui token entry form (POST /api/auth with JSON body
{"token": "..."}) and the 6-digit pairing flow (POST /api/devices/pair)
were returning 500 through the vhost instead of 204/401. nginx's
auth_request subrequest hits authelia first; authelia returns 401
because the visitor is not signed in yet (no authelia cookie);
error_page 401 =302 then tries to redirect the original POST, but
nginx's 302 rewrite only works cleanly for GET — the POST round
trips to a 500 ("auth request unexpected status" in the nginx
error log). Same root cause as the working vtimeline/tty vhosts,
where the form is GET-only and the redirect works.

Fix: add a regex location '~ ^/api/(auth|devices/pair|health)$'
that proxies these three paths to 127.0.0.1:7317 WITHOUT the
authelia auth_request. The Bun server's own auth.ts keeps the same
three paths open in requiresAuth() (server/auth.ts:79-85), so a
missing or wrong token is rejected there with 401 + JSON body —
the gate is enforced one layer down, just not by authelia.

Verified after the rebuild:
  POST /api/auth (body=token)         -> 204 + set-cookie herdr_web_token
  POST /api/devices/pair (code=...)   -> 401 invalid_code (not 500)
  GET  /api/health                    -> 200

Real-browser flow now: visitor opens herdr.zeroq.su -> authelia
login -> web UI shows pair/token form -> submit POST /api/auth
works -> HttpOnly cookie set -> app loads.
2026-10-19 18:23:18 +03:00
..
2026-10-09 16:37:03 +03:00
2026-08-09 23:51:49 +03:00
2026-10-09 19:26:31 +03:00
2026-07-06 01:56:06 +03:00
2026-10-09 16:59:45 +03:00
2026-06-29 23:03:17 +03:00
2026-09-22 18:31:00 +03:00
2026-08-10 03:36:19 +03:00
2026-10-19 18:23:17 +03:00
2026-07-06 01:56:06 +03:00
2026-09-23 23:17:39 +03:00
2026-08-09 01:11:23 +03:00
2026-06-14 01:59:39 +03:00
2026-10-09 16:59:45 +03:00
2026-10-09 16:59:45 +03:00