Skip to content

Traefik forwardauth middleware and different domains #1985

Open

Description

@yanus

Is your feature request related to a problem? Please describe.

I have multiple sites hosted under distinct root domains (e.g. domain1.org, domain2.org, domain3.org), some of which I want to protect with Anubis. I am using Traefik as the reverse proxy. The setup that I have found working is to have the routes that I want to protect go to Anubis first which then proxies them back to Traefik through a separate entrypoint to be routed to the actual backend services (e.g. WordPress container).
However, this seems clunky and unnecessary, and may result in skewed metrics. It would be nicer to be able to use the forwardauth middleware like in the recommended Traefik setup. But this fails, because it requires Anubis to be hosted under one specific root domain (e.g. anubis.domain1.org) meaning its cookies won't be available to subsequent requests to e.g. domain2.org, leading to a redirect loop.

Solution you would like.

I can think of two possible solutions:

  1. Keep serving Anubis from a single domain, but add a validation token (e.g. in the query string) when redirecting back to the other domain, which then results in the request being validated and setting the cookies correctly (this might require Add forwardAuth.addAuthCookiesToResponseRegex traefik/traefik#12229 to be merged by Traefik).
  2. Serve Anubis under a path prefix of each domain. This would require the public url to be dynamically constructed based on the Host of the request, instead of having to provide it as a static environment variable.

Describe alternatives you have considered.

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions