Skip to content

outposts, internal/outpost: keep the web path when outposts connect to authentik - #27290

Merged
dominic-r merged 2 commits into
mainfrom
dominic/outposts-web-path
Oct 29, 2026
Merged

dominic-r merged 2 commits into
mainfrom
dominic/outposts-web-path

Conversation

@dominic-r

@dominic-r dominic-r commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Details

What does this PR change?

Outposts now reach authentik below the path of AUTHENTIK_HOST, so they work when authentik runs under AUTHENTIK_WEB__PATH:

  • The RAC outpost opens its session websocket at <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 of AUTHENTIK_HOST.
  • The API base is joined onto the path of AUTHENTIK_HOST, so https://authentik.company/authentik without a trailing slash no longer becomes /authentikapi/v3.
  • The default outpost config, which the admin interface pre-fills when an outpost is created, sets authentik_host to 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 logs websocket: 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_HOST has 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-main dev images behind nginx, which only sends /authentik/ to authentik, with a standalone RAC outpost and an SSH server, and launched the device in Chromium:

  • With the stock outpost (and the web fix), the outpost's 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.
  • With 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_settings returned http://127.0.0.1:18803/authentik/ under the web path and http://127.0.0.1:18803/ without one.
  • Without a web path, the RAC session still opened.

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

  • The project has been linted, built, and tested (make all)
  • The documentation has been updated and formatted (make docs)
  • I have read the AI usage policy.

…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
@dominic-r
dominic-r requested a review from a team as a code owner October 27, 2026 23:36
@dominic-r dominic-r added area:backend backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8 labels Oct 27, 2026
@dominic-r dominic-r self-assigned this Oct 27, 2026
@netlify

netlify Bot commented Oct 27, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 3b3881f
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6ae1358e178b2f1241fa656c
😎 Deploy Preview https://deploy-preview-27290--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.48%. Comparing base (98c4b28) to head (b4b0de4).
✅ All tests successful. No failed tests found.

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           
Flag Coverage Δ
conformance 31.14% <8.33%> (-0.01%) ⬇️
e2e 36.01% <8.33%> (+<0.01%) ⬆️
integration 28.62% <8.33%> (-0.01%) ⬇️
rust 45.98% <ø> (ø)
unit 94.13% <100.00%> (+<0.01%) ⬆️
unit-migrate 94.13% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Playwright e2e

Download 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-report

Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

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)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

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-distroless

Afterwards, run the upgrade commands from the latest release notes.

@dominic-r
dominic-r merged commit 9a68e73 into main Oct 29, 2026
171 checks passed
@dominic-r
dominic-r deleted the dominic/outposts-web-path branch October 29, 2026 15:24
@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.8 created: #27347

BeryJu pushed a commit that referenced this pull request Nov 23, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RAC doesn’t work when authentik runs under a web path (AUTHENTIK_WEB__PATH)

2 participants