Skip to content

use local authelia socket for auth subrequests - #3

Open
cyberb wants to merge 1 commit into
masterfrom
fix/authelia-local-socket
Open

use local authelia socket for auth subrequests#3
cyberb wants to merge 1 commit into
masterfrom
fix/authelia-local-socket

Conversation

@cyberb

@cyberb cyberb commented Aug 28, 2026

Copy link
Copy Markdown
Member

Back-port of the auth-socket fix. Companion to syncloud/transmission#1, where this bug was caught in the field.

config/authelia-location.conf proxies /internal/authelia/authz to the public auth URL. nginx resolves a literal hostname in proxy_pass once at config load and caches it for the process lifetime — it never re-resolves. On a device with a dynamic prefix the cached address goes stale and every request hangs on proxy_connect_timeout before failing the subrequest, surfacing as a 500.

Switching to GetAuthLocalSocket() — a fixed local socket path — removes the name to resolve and the cache to go stale.

Why now

This is the same fix owntracks got in 8089a34 (2026-04-16). It propagated to every app packaged after it, but the three that already existed were never back-ported. Transmission hit it for real: its nginx had held a dead address for five months after the ISP rotated the IPv6 /64.

Worth noting for this repo specifically: youtube was last touched 2026-08-24 and still went in on the old pattern. So this is not just old apps drifting — the current pattern was not reaching new work either.

Validation

Verified end-to-end on transmission, not on youtube — the code change here is identical, but the runtime confirmation came from the app that was actually broken:

before after
status 500 302 to login
latency ~240s hang 0.53s

Here: go build, go vet and gofmt clean. Leaving real verification to CI.

Notes for review

  • No dependency change — this repo is already on golib v1.1.22, which exports GetAuthLocalSocket.
  • AuthAddress is kept: it is still referenced by the commented-out legacy redirect in config/authelia-authrequest.conf:32, and Go templates render inside # comments, so removing the field would break generation.

The auth subrequest proxied to the public auth URL, which nginx resolves
once at config load and then caches for the lifetime of the process. On
a device with a dynamic prefix the cached address goes stale and every
request to the app hangs on proxy_connect_timeout before failing the
subrequest, surfacing as a 500.

GetAuthLocalSocket returns a fixed local path, so there is no name to
resolve and no cache to go stale. Same fix owntracks got in 8089a34; it
reached every app packaged after it, but the ones that already existed
were never back-ported. Confirmed in the field on transmission, whose
nginx had held a dead address for five months after the ISP rotated the
IPv6 /64.

No golib bump needed here, already on v1.1.22.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant