root: support running authentik in subpath (#8675)
* initial subpath support Signed-off-by: Jens Langhammer <jens@goauthentik.io> * make outpost compatible Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix static files somewhat Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix web interface Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix most static stuff Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix most web links Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix websocket Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix URL for static files Signed-off-by: Jens Langhammer <jens@goauthentik.io> * format web Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add root redirect for subpath Signed-off-by: Jens Langhammer <jens@goauthentik.io> * update docs Signed-off-by: Jens Langhammer <jens@goauthentik.io> * set cookie path Signed-off-by: Jens Langhammer <jens@goauthentik.io> * Update internal/config/struct.go Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> Signed-off-by: Jens L. <jens@beryju.org> * fix sfe Signed-off-by: Jens Langhammer <jens@goauthentik.io> * bump required version Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix flow background Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix lint and some more links Signed-off-by: Jens Langhammer <jens@goauthentik.io> * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix impersonate Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Signed-off-by: Jens L. <jens@beryju.org> Signed-off-by: Jens L. <jens@goauthentik.io> Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
		| @ -68,7 +68,7 @@ export function getMetaContent(key: string): string { | ||||
| } | ||||
|  | ||||
| export const DEFAULT_CONFIG = new Configuration({ | ||||
|     basePath: (process.env.AK_API_BASE_PATH || window.location.origin) + "/api/v3", | ||||
|     basePath: `${globalAK().api.base}api/v3`, | ||||
|     headers: { | ||||
|         "sentry-trace": getMetaContent("sentry-trace"), | ||||
|     }, | ||||
|  | ||||
| @ -11,6 +11,9 @@ export interface GlobalAuthentik { | ||||
|     versionFamily: string; | ||||
|     versionSubdomain: string; | ||||
|     build: string; | ||||
|     api: { | ||||
|         base: string; | ||||
|     }; | ||||
| } | ||||
|  | ||||
| export interface AuthentikWindow { | ||||
| @ -35,6 +38,9 @@ export function globalAK(): GlobalAuthentik { | ||||
|             versionFamily: "", | ||||
|             versionSubdomain: "", | ||||
|             build: "", | ||||
|             api: { | ||||
|                 base: process.env.AK_API_BASE_PATH || window.location.origin, | ||||
|             }, | ||||
|         }; | ||||
|     } | ||||
|     return ak; | ||||
|  | ||||
| @ -1,4 +1,5 @@ | ||||
| import { EVENT_MESSAGE, EVENT_WS_MESSAGE } from "@goauthentik/common/constants"; | ||||
| import { globalAK } from "@goauthentik/common/global"; | ||||
| import { MessageLevel } from "@goauthentik/common/messages"; | ||||
|  | ||||
| import { msg } from "@lit/localize"; | ||||
| @ -21,9 +22,8 @@ export class WebsocketClient { | ||||
|  | ||||
|     connect(): void { | ||||
|         if (navigator.webdriver) return; | ||||
|         const wsUrl = `${window.location.protocol.replace("http", "ws")}//${ | ||||
|             window.location.host | ||||
|         }/ws/client/`; | ||||
|         const apiURL = new URL(globalAK().api.base); | ||||
|         const wsUrl = `${window.location.protocol.replace("http", "ws")}//${apiURL.host}${apiURL.pathname}ws/client/`; | ||||
|         this.messageSocket = new WebSocket(wsUrl); | ||||
|         this.messageSocket.addEventListener("open", () => { | ||||
|             console.debug(`authentik/ws: connected to ${wsUrl}`); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens L.
					Jens L.