oqyude 61ad57a102
test-runner / smoke (push) Canceled after 0s
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-15 04:56:55 +03:00
2026-10-13 16:16:20 +03:00
2026-10-13 16:16:20 +03:00
2026-05-04 20:23:20 +03:00
2026-08-11 02:31:00 +03:00
ref
2026-03-29 14:46:01 +03:00
2026-10-14 14:33:34 +03:00
2026-10-13 16:16:20 +03:00
2026-10-13 16:16:20 +03:00
2026-06-10 12:38:23 +03:00

I'm a super newbie who just posted my stuff here. Now maybe about intermediate

S
Description
My NixOS configuration
Readme
4.6 MiB
0 Stars 1 Watchers 0 Forks
Languages
Nix 82.8%
Python 9%
Shell 7.3%
Dockerfile 0.5%
Perl 0.4%