Repository navigation
outposts, internal/outpost: keep the web path when outposts connect to authentik - #27290
Conversation
…o authentik With authentik under AUTHENTIK_WEB__PATH, outposts could not reach it: - The RAC outpost built its session websocket URL from the API client's scheme and host only, so it dialed /ws/outpost_rac/... and got a 404, while the control websocket already kept the path. Both now go through one dialer, which also gives the session websocket the unix socket support and query parameters of the control websocket. - The API base was the path of AUTHENTIK_HOST with "api/v3" appended, so a path without a trailing slash, such as /authentik, became /authentikapi/v3. The websockets already joined the path correctly. - The default outpost config, which the admin interface pre-fills for new outposts, set authentik_host to the server root. Closes: #26803
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #27290 +/- ##
=======================================
Coverage 92.48% 92.48%
=======================================
Files 1197 1197
Lines 81116 81127 +11
Branches 4497 4497
=======================================
+ Hits 75017 75031 +14
+ Misses 6033 6030 -3
Partials 66 66
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Playwright e2eDownload this run's HTML report and traces, then open the report: gh run download 40803253255 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-reportInstallation instructionsInstructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-b4b0de46d4ad32fd5e2cb4e8d0c3199496bf53dd
# Distroless image: AUTHENTIK_TAG=gh-b4b0de46d4ad32fd5e2cb4e8d0c3199496bf53dd-distroless
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-b4b0de46d4ad32fd5e2cb4e8d0c3199496bf53dd
# Distroless image: tag: gh-b4b0de46d4ad32fd5e2cb4e8d0c3199496bf53dd-distrolessAfterwards, run the upgrade commands from the latest release notes. |
|
🍒 Cherry-pick to |
…o authentik (cherry-pick #27290 to version-2026.8) (#27347) * outposts, internal/outpost: keep the web path when outposts connect to authentik (#27290) With authentik under AUTHENTIK_WEB__PATH, outposts could not reach it: - The RAC outpost built its session websocket URL from the API client's scheme and host only, so it dialed /ws/outpost_rac/... and got a 404, while the control websocket already kept the path. Both now go through one dialer, which also gives the session websocket the unix socket support and query parameters of the control websocket. - The API base was the path of AUTHENTIK_HOST with "api/v3" appended, so a path without a trailing slash, such as /authentik, became /authentikapi/v3. The websockets already joined the path correctly. - The default outpost config, which the admin interface pre-fills for new outposts, set authentik_host to the server root. Closes: #26803 * locale: add upgrader to the Go dictionary The RAC connection test uses gorilla/websocket's Upgrader, which cspell on version-2026.8 does not know. --------- Co-authored-by: Dominic Roy <[email protected]>
Details
What does this PR change?
Outposts now reach authentik below the path of
AUTHENTIK_HOST, so they work when authentik runs underAUTHENTIK_WEB__PATH:<path>/ws/outpost_rac/<channel>/instead of/ws/outpost_rac/<channel>/. It now uses the same dialer as the control websocket, which already kept the path, so it also gets that dialer's unix socket support and the query parameters ofAUTHENTIK_HOST.AUTHENTIK_HOST, sohttps://authentik.company/authentikwithout a trailing slash no longer becomes/authentikapi/v3.authentik_hostto the web path instead of the server root.Why is this change needed?
In #26803, an RDP session through RAC never opens with
AUTHENTIK_WEB__PATH=/authentik/. Even with the browser side fixed (#27291), the outpost dials/ws/outpost_rac/..., which the reverse proxy doesn't route to authentik, and it logswebsocket: bad handshake.The other two problems stop any outpost under a web path before it gets that far. An outpost created from the admin interface points at the server root, and an outpost whose
AUTHENTIK_HOSThas no trailing slash can't call the API.How was this tested?
Added a test that starts an outpost against a fake authentik served under
/authentik(no trailing slash) and opens a RAC session websocket. With the old session websocket URL it fails, and with the old API base it never gets past fetching the outpost configuration. Added tests for the default config at the root and under a web path. The web path one fails without this change.I ran the
gh-maindev images behind nginx, which only sends/authentik/to authentik, with a standalone RAC outpost and an SSH server, and launched the device in Chromium:GET /ws/outpost_rac/...got a 404 from nginx and the session never opened. With this change the outpost connected to/authentik/ws/outpost_rac/...and the SSH prompt rendered.AUTHENTIK_HOST=http://nginx/authentik, the stock outpost kept retrying/authentikapi/v3/outposts/instances/and getting a 404. With this change it started, and the SSH session opened.default_settingsreturnedhttp://127.0.0.1:18803/authentik/under the web path andhttp://127.0.0.1:18803/without one.The commit also applies cleanly to
version-2026.8.Linked issues
Closes #26803
The browser side of the issue is fixed in #27291. Both are needed for RAC to work under a web path.
Checklist
make all)make docs)