Skip to content

Run Authentik in subfolder behind Traefik Proxy #4509

@domingorocho

Description

@domingorocho

Describe your question/
Due to various reasons I can't run authentik as subdomain (e.g. auth.example.com). I wan't to use authentik as a subfolder under my domain, e.g. example.com/auth/. Additionally I run authentik behind a traefik proxy like I do with many other services, also with subfolders ( example.com/service1/, example.com/service2/ etc.).

The first call to example.com/auth/ actually reaches authentik, because it redirects me to the first flow (.../flows/-/default/authentication/?next=/) BUT it cuts the subfolder so instead of example.com/auth/flows/-/default/authentication/?next=/ it cuts the subfolder and redirects to example.com/flows/-/default/authentication/?next=/ resulting in a 404 error on traefik.

In other docker containers there is something like BASE_URL or ROOT_URL, but I haven't found anything like that.
I even searched and played around in authentik/root/settings.py and in authentik/root/urls.py but without success, but I'm a noob in python.

Relevant infos
My traefik labels are:

- "traefik.enable=true"
- "traefik.http.routers.authentik-secure.entrypoints=websecure"
- "traefik.http.routers.authentik-secure.tls=true"
# route to subfolder
- "traefik.http.routers.authentik-secure.rule=Host(`example.com`) && PathPrefix(`/auth{regex:$$|/.*}`)"
- "traefik.http.routers.authentik-secure.middlewares=authentik-secure-stripprefix"
- "traefik.http.middlewares.authentik-secure-stripprefix.stripprefix.prefixes=/auth"
- "traefik.http.services.authentik-secure.loadbalancer.server.port=9000"

I tried the pathprefix with or without regex and with or without stripprefix.

Version and Deployment (please complete the following information):

  • authentik version: latest
  • Deployment: docker-compose

Thanks for your help in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestenhancement/confirmedEnhancements that will be implemented in the future

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions