Feature Request / Bug: External Proxy Outpost cannot use persistent session backend (filesystem-only in /dev/shm causes 400s on restart)
Is your feature request related to a problem?
Summary
The external Proxy Outpost (ghcr.io/goauthentik/proxy) appears to only support a filesystem-based session backend, writing session files into os.TempDir() (in the official image this ends up being /dev/shm).
As a consequence, any container restart wipes all active sessions, which systematically breaks both in-progress authentication flows and already-established authenticated sessions: subsequent requests or callbacks fail with HTTP 400 Bad Request because the state/session that the browser sends no longer exists on the Outpost side.
This is a serious stability issue in production where Outposts must be restarted for upgrades or configuration changes.
I would like to request:
- A configurable, persistent session backend for external Proxy Outposts (ideally Postgres, possibly others).
- An option to fail hard (crash/exit) if the configured backend is unavailable, instead of silently falling back to ephemeral filesystem storage.
Environment
- Authentik version:
2025.12(server) - Proxy Outpost image:
ghcr.io/goauthentik/proxy:2025.12 - Deployment: Docker / Docker Compose
- Architecture:
authentik/serverwith Postgres- External Proxy Outpost (
ghcr.io/goauthentik/proxy) as a separate container - Reverse proxy (Traefik) using the outpost in forward-auth mode
Problem Description
Behaviour observed
-
The external Proxy Outpost logs:
INF | event=using filesystem session backend logger=authentik.outpost.proxyv2 ... -
Session files are written to
/dev/shminside the Outpost container:root@authentik-proxy:/dev/shm# ls session_7SISASK... session_RFCLJ2... -
When the Proxy container is restarted (upgrade, config change, etc.):
/dev/shmis cleared and all Outpost session files disappear.- Any user whose browser still holds an Outpost session cookie (whether they were mid-flow or already logged in to an application) will, on the next request that passes through the Outpost (callback, page load, XHR, etc.), hit a
400 Bad Requestbecause the server-side session no longer exists. - Clearing cookies and starting a new login flow works again, but the previous session/flow is irrecoverably broken.
This is reproducible every time: any restart instantly invalidates all active sessions and will break them on the next interaction with the Outpost.
Attempts to fix / configure
I tried several approaches to make the Outpost use a persistent backend instead of ephemeral filesystem:
-
Redis
-
Added a dedicated Redis container on the same Docker network.
-
Set
AUTHENTIK_REDIS__HOST=redis(and related envs) on the Proxy Outpost container. -
Expected: the Outpost uses Redis sessions.
-
Actual: no visible change, logs still say:
INF | event=using filesystem session backend logger=authentik.outpost.proxyv2 ...
No error or warning is emitted about an inability to connect to Redis; it just silently stays on filesystem.
-
-
Postgres env vars on the Outpost
-
Tried providing
POSTGRES_HOST,POSTGRES_PASSWORD, etc. to the Proxy Outpost container (similar toauthentik/server). -
On startup, the container logs:
warning | env_var=POSTGRES_PASSWORD event=Environment variable not found, using fallback fallback= found=false -
Even when that warning is resolved, the Outpost still logs
using filesystem session backendand continues to store sessions under/dev/shm.
-
This strongly suggests that for the external Outpost binary, Redis/Postgres session backends are simply not wired up / configurable today.
Technical Analysis
Looking at the proxyv2 session handling code, the behaviour seems to be:
-
When the Outpost is embedded (running inside
authentik/server), it can use the server’sSessionBackend()value and supports Postgres as a session backend. -
When the Outpost is external (
ghcr.io/goauthentik/proxy),isEmbedded == false, and the code path unconditionally creates a filesystem store inos.TempDir()and logs:using filesystem session backend
In other words:
- The embedded Outpost benefits from a Postgres-backed session store.
- The external Outpost is hard-coded to filesystem sessions in
os.TempDir()with no configuration hook to change the backend.
Why this is a problem in production
For the external Proxy Outpost, this design means:
- Any restart is a hard cut of all active sessions/flows.
- Users who were already logged in can suddenly hit
400 Bad Requeston the next request that passes through the Outpost, because their session cookie no longer matches any server-side session data. - In an environment with multiple upgrades, rolling deployments, or configuration adjustments, this results in frequent broken sessions and auth flows and a very poor UX.
There is also currently no way to tell the Outpost:
“Use Postgres (or another persistent backend), and if you cannot connect to it, do not start (or at least fail loudly).”
Instead, the Outpost just falls back to ephemeral filesystem storage without a clear indication.
Workarounds considered
1. Mounting a volume on /dev/shm
Technically, one can mount a persistent Docker volume on /dev/shm to keep the session files across restarts.
However:
/dev/shmis meant to be a tmpfs for shared memory, not for persistent disk.- Overriding it with a disk-backed volume is a hacky, non-obvious workaround.
- This feels wrong and fragile for production, even if it “works”.
2. Redirecting os.TempDir() via TMPDIR
Another (slightly cleaner) workaround is:
- Set
TMPDIR=/sessionsin the external Outpost container. - Mount a Docker volume on
/sessions.
This way, the filesystem session store still works as designed (using os.TempDir()), but points to a persistent directory instead of /dev/shm.
This is more acceptable than mounting over /dev/shm, but:
- It is still an implicit hack depending on Go’s
os.TempDir()behaviour. - It does not address the lack of visibility/configurability of the session backend.
- There is no way to make startup fail if the intended persistent backend is not available.
Feature Request
1. Configurable session backend for external Proxy Outposts
For the external Proxy Outpost (ghcr.io/goauthentik/proxy), please add:
-
Support for a Postgres-backed session store (similar to the embedded Outpost).
-
A way to select the backend via configuration, for example:
- An environment variable like
AUTHENTIK_PROXY_SESSION_BACKEND=postgres|filesystem - Or some configuration provided via the Outpost config from the core server.
- An environment variable like
-
If the backend is set to
postgres, the Outpost should:- Use connection settings provided via env/config (e.g.
POSTGRES_*). - Fail clearly (and preferably exit non-zero) if it cannot connect, rather than silently falling back to filesystem.
- Use connection settings provided via env/config (e.g.
2. Explicit error / no silent fallback
If a persistent backend is configured but not reachable (Postgres unavailable, wrong credentials, etc.), the Outpost should:
- Log a clear ERROR explaining the situation.
- Optionally refuse to start (or run in a degraded mode that is very explicit), instead of silently reverting to ephemeral filesystem sessions.
Why this matters
- External Proxy Outposts are common in real-world deployments (separate nodes, DMZs, etc.).
- Having their session state silently stored in volatile RAM (
/dev/shm) is extremely fragile. - Admins need a way to:
- Use a proper persistent backend (Postgres, ideally).
- Be sure that the Outpost will not surprise them by silently degrading back to ephemeral filesystem storage.
Thank you for considering this. I’m happy to provide more logs, configs, or help test any changes that make the session backend of the external Proxy Outpost configurable and properly persistent.
Describe the solution you'd like
No response
Describe alternatives that you've considered
-
Use the embedded outpost instead of the external proxy.
This is not always possible or desirable:
- the external outpost is deployed on separate hosts/DMZs,
- we specifically need a standalone proxy component decoupled from the core server,
- changing the architecture just to get persistent sessions is not a realistic option in some environments.
-
Mount a persistent volume over
/dev/shm.Technically works, but:
/dev/shmis meant to be tmpfs/shared memory, not persistent disk,- overriding it with a disk-backed volume is hacky and non-obvious,
- it feels fragile and not appropriate for a clean production setup.
-
Redirect
os.TempDir()viaTMPDIRand mount a volume there.This is slightly cleaner and I may use it as a temporary workaround, but:
- it relies on implicit
os.TempDir()behaviour instead of a first-class session backend option, - it does not solve the lack of visibility/configuration around which backend is used,
- there is still no way to make the outpost fail fast if a persistent backend is expected but not available.
- it relies on implicit
Additional context
No response
Related to my discussion here : https://github.com/goauthentik/authentik/discussions/20023
This feature request is valid, but not on the roadmap currently and not something we plan to do any time soon.
Hello @rissson ! I discussed this with Dominic, your colleague (who is very nice, by the way), and he clarified things for me. Take your time, I at least have the answer to my questions. Thank you for the solution you are providing. I will wait patiently, persisting sessions on an external proxy outpost.
If I configure an external proxy outpost this is what happens:
- The user logs in through the outpost, and the outpost creates
/dev/shm/session_X. - The outpost is restarted,
/dev/shm/session_Xis lost. - The user accesses the forward-auth protected resources, and the outpost detects the issue with the missing session.
- The outpost generates an error
failed to get session, clearing stale cookieand redirects the user tohttps://authentik.liri.ie/outpost.goauthentik.io/callback?X-authentik-auth-callback=true...which returns HTTP400: - I open the protected resource again and the authentication succeeds. I don't need to log in again, I don't need to use my credentials, the outpost is able to handle the forward-auth without my input.
To me this looks like losing the session in the outpost didn't actually invalidate my logged in state. The outpost is able to recreate the session from the browser state I had without the need to re-enter credentials.
Would it be possible to replace the HTTP400 with an appropriate redirect and heal this missing session state? It doesn't seem that a persistent session store is actually necessary here. And this is probably much simpler to implement.
+1!!
We're closing this in favor of this parent issue: #25248