Traefik Forward Auth
GitHub

All configuration options

Root configuration object#

NameTypeDescription
server.hostnamestringThe hostname the application is reached at.
This is used for setting the “redirect_uri” field for OAuth2 callbacks.
Required
server.portnumberPort to bind to.Default: 4181
server.bindstringAddress/interface to bind to.Default: “0.0.0.0”
server.basePathstringBase path for all routes.
Set this if Traefik is forwarding requests to traefik-forward-auth for specific paths only.
Note: this does not apply to /healthz routes
server.tlsPathstringPath where to load TLS certificates from. Within the folder, the files must be named tls-cert.pem and tls-key.pem (and optionally tls-ca.pem).
The server watches for changes in this folder and automatically reloads the TLS certificates when they’re updated.
If empty, certificates are loaded from the same folder where the loaded config.yaml is located.
Default: Folder where the config.yaml file is located
server.tlsCertPEMstringFull, PEM-encoded TLS certificate.
Using server.tlsCertPEM and server.tlsKeyPEM is an alternative method of passing TLS certificates than using server.tlsPath.
server.tlsKeyPEMstringFull, PEM-encoded TLS key.
Using server.tlsCertPEM and server.tlsKeyPEM is an alternative method of passing TLS certificates than using server.tlsPath.
server.tlsCAPEMstringFull, PEM-encoded TLS CA certificate, used for TLS client authentication (mTLS).
This is an alternative method of passing the CA certificate than using tlsPath.
Note that this is ignored unless server.tlsClientAuth is set to true.
server.tlsClientAuthbooleanIf true, enables mTLS for client authentication.
Requests to the root endpoint (normally used by Traefik) must have a valid client certificate signed by the CA.
Default: false
server.trustedRequestIdHeaderstringString with the name of a header to trust as ID of each request. The ID is included in logs and in responses as X-Request-ID header.
Common values include:

- X-Request-ID: a de-facto standard that’s vendor agnostic
- CF-Ray: when the application is served by a Cloudflare CDN

If this option is empty, or if it contains the name of a header that is not found in an incoming request, a random UUID is generated as request ID.
server.faviconstringFavicon for the app.
If this starts with “http://” or “https://”, it’s treated as a URL and fetched when the server starts up.
Otherwise, it’s treated as base64-encoded image data.
The favicon must be an ICO, PNG, or SVG image.
cookies.domainstringDomain name for setting cookies.
If empty, this is set to the value of the hostname property.
This value must either be the same as the hostname property, or the hostname must be a sub-domain of the cookie domain name.
Recommended
cookies.namePrefixstringPrefix for the cookies used to store the sessions.Default: “tf_sess”
cookies.insecurebooleanIf true, sets cookies as “insecure”, which are served on HTTP endpoints too.
By default, this is false and cookies are sent on HTTPS endpoints only.
Default: false
tokens.sessionLifetimedurationLifetime for sessions after a successful authentication.
This can be overridden on each portal.
Default: “2h”
tokens.signingKeystringString used as key to sign state tokens.
Can be generated for example with openssl rand -base64 32
If left empty, it will be randomly generated every time the app starts (recommended, unless you need user sessions to persist after the application is restarted).
tokens.signingKeyFilestringFile containing the key used to sign state tokens.
This is an alternative to specifying signingKey tokens.directly.
tokens.sessionTokenAudiencestringValue for the audience claim to expect in session tokens used by Traefik Forward Auth.
Defaults to a value based on cookies.domain and server.basePath which is appropriate for the majority of cases. Most users should rely on the default value.
logs.levelstringControls log level and verbosity. Supported values: debug, info (default), warn, error.Default: “info”
logs.omitHealthChecksbooleanIf true, calls to the healthcheck endpoint (/healthz) are not included in the logs.Default: true
logs.jsonbooleanIf true, emits logs formatted as JSON, otherwise uses a text-based structured log format.
Defaults to false if a TTY is attached (e.g. in development); true otherwise.
defaultPortalstringIf set to the name of a portal defined in “portals”, it makes the portal available on the root endpoint, without the portals/<name>/ prefix

Portal configuration#

NameTypeDescription
portals.$.namestringName of the portal, as used in the URL.Required
portals.$.displayNamestringOptional display name.
Defaults to the name property if not set.
portals.$.alwaysShowProvidersPagebooleanIf true, always shows the providers selection page, even when there’s a single provider configured.
Has no effect when there’s more than one provider configured.
Default: false
portals.$.authenticationTimeoutdurationTimeout for authenticating with the authentication provider.Default: 5m
portals.$.sessionLifetimedurationLifetime for sessions after a successful authentication for the portal.
If set, this overrides the default value configured in the tokens section for this portal.
portals.$.backgroundMediumstringURL to override the background image for the portal, size medium.
The recommended size is 720x1080.
portals.$.backgroundLargestringURL to override the background image for the portal, size large.
The recommended size is 940x1410.
providerslist of provider configurationsList of allowed authentication providers
See the provider configuration section for more details.
Required
At least one provider is required.

Provider Configuration#

The configuration depends on the kind of provider used. Currently, the following providers are supported:

Using GitHub#

NameTypeDescription
portals.$.providers.$.github.namestringName of the authentication provider
Defaults to the name of the provider type
portals.$.providers.$.github.displayNamestringOptional display name for the provider
Defaults to the standard display name for the provider
portals.$.providers.$.github.clientIDstringClient ID for the GitHub auth applicationRequired
portals.$.providers.$.github.clientSecretstringClient secret for the GitHub application
One of clientSecret and clientSecretFile is required.
Required
portals.$.providers.$.github.clientSecretFilestringFile containing the client secret for the GitHub application
This is an alternative to passing the secret as clientSecret
One of clientSecret and clientSecretFile is required.
portals.$.providers.$.github.requestTimeoutdurationTimeout for network requests for GitHub authDefault: “10s”
portals.$.providers.$.github.iconstringOptional icon for the provider
Defaults to the standard icon for the provider
portals.$.providers.$.github.colorstringOptional color scheme for the provider
Allowed values include all color schemes available in Tailwind 4
Defaults to the standard color for the provider

Example:

portals:
  name: "default"
  providers:
    -
        github:
          #name: "my-github-auth"
          #displayName: "GitHub"
          clientID: "your-client-id"
          clientSecret: "your-client-secret"
          #clientSecretFile: "/var/run/secrets/traefik-forward-auth/github/client-secret"
          ## Default: "10s"
          #requestTimeout: "10s"
          #icon: "github"
          #color: "emerald"

Using Google#

NameTypeDescription
portals.$.providers.$.google.namestringName of the authentication provider
Defaults to the name of the provider type
portals.$.providers.$.google.displayNamestringOptional display name for the provider
Defaults to the standard display name for the provider
portals.$.providers.$.google.clientIDstringClient ID for the Google auth applicationRequired
portals.$.providers.$.google.clientSecretstringClient secret for the Google auth application
One of clientSecret and clientSecretFile is required.
Required
portals.$.providers.$.google.clientSecretFilestringFile containing the client secret for the Google auth application
This is an alternative to passing the secret as clientSecret
One of clientSecret and clientSecretFile is required.
portals.$.providers.$.google.requestTimeoutdurationTimeout for network requests for Google authDefault: “10s”
portals.$.providers.$.google.scopesstringOAuth2 scopes to requestDefault: “openid profile email”
portals.$.providers.$.google.iconstringOptional icon for the provider
Defaults to the standard icon for the provider
portals.$.providers.$.google.colorstringOptional color scheme for the provider
Allowed values include all color schemes available in Tailwind 4
Defaults to the standard color for the provider

Example:

portals:
  name: "default"
  providers:
    -
        google:
          #name: "my-google-auth"
          #displayName: "Google"
          clientID: "your-google-client-id.apps.googleusercontent.com"
          clientSecret: "your-client-secret"
          #clientSecretFile: "/var/run/secrets/traefik-forward-auth/google/client-secret"
          ## Default: "10s"
          #requestTimeout: "10s"
          ## Default: "openid profile email"
          #scopes: "openid profile email"
          #icon: "google"
          #color: "yellow"

Using Microsoft Entra ID#

NameTypeDescription
portals.$.providers.$.microsoftEntraID.namestringName of the authentication provider
Defaults to the name of the provider type
portals.$.providers.$.microsoftEntraID.displayNamestringOptional display name for the provider
Defaults to the standard display name for the provider
portals.$.providers.$.microsoftEntraID.tenantIDstringTenant ID for the Microsoft Entra ID auth application
+example
Required
portals.$.providers.$.microsoftEntraID.clientIDstringClient ID for the Microsoft Entra ID auth applicationRequired
portals.$.providers.$.microsoftEntraID.clientSecretstringClient secret for the Microsoft Entra ID auth application
Required when not using Federated Identity Credentials
portals.$.providers.$.microsoftEntraID.clientSecretFilestringFile containing the client secret for the Microsoft Entra ID application.
This is an alternative to passing the secret as clientSecret
portals.$.providers.$.microsoftEntraID.clientAssertionstringEnables the usage of client assertions (also known as “Federated Identity Credentials” or “Federated Workload Credentials”) to obtain assertions for Microsoft Entra ID applications.
This is an alternative to using client secrets, when the application is running in an environment that supports other ways to obtain federated credentials.
Currently, these values are supported:

- AzureManagedIdentity: uses Azure Managed Identity with a system-assigned identity
- AzureManagedIdentity=client-id: uses Azure Managed Identity with a user-assigned identity whose client id is “client-id” (e.g. AzureManagedIdentity=00000000-0000-0000-0000-000000000000)
- AzureWorkloadIdentity: uses Azure Workload Identity, e.g. in Kubernetes
- KubernetesServiceAccountToken=path: uses a token read from a Kubernetes service account token file. If path is omitted, defaults to /var/run/secrets/kubernetes.io/serviceaccount/token.
- tsiam=endpoint: uses tsiam to obtain Workload Identity from nodes that use Tailscale. Specify the endpoint of tsiam as value, e.g. tsiam=https://tsiam. Uses as resource name the constant value api://AzureADTokenExchange.
portals.$.providers.$.microsoftEntraID.requestTimeoutdurationTimeout for network requests for Microsoft Entra ID authDefault: “10s”
portals.$.providers.$.microsoftEntraID.scopesstringOAuth2 scopes to requestDefault: “openid profile email”
portals.$.providers.$.microsoftEntraID.iconstringOptional icon for the provider
Defaults to the standard icon for the provider
portals.$.providers.$.microsoftEntraID.colorstringOptional color scheme for the provider
Allowed values include all color schemes available in Tailwind 4
Defaults to the standard color for the provider

Example:

portals:
  name: "default"
  providers:
    -
        microsoftEntraID:
          #name: "my-microsoft-entra-id-auth"
          #displayName: "Microsoft Entra ID"
          tenantID: ""
          clientID: "your-client-id"
          #clientSecret: "your-client-secret"
          #clientSecretFile: "/var/run/secrets/traefik-forward-auth/microsoft-entra-id/client-secret"
          #clientAssertion: ""
          ## Default: "10s"
          #requestTimeout: "10s"
          ## Default: "openid profile email"
          #scopes: "openid profile email"
          #icon: "microsoft"
          #color: "cyan"

Using OpenID Connect#

NameTypeDescription
portals.$.providers.$.openIDConnect.namestringName of the authentication provider
Defaults to the name of the provider type
portals.$.providers.$.openIDConnect.displayNamestringOptional display name for the provider
Defaults to the standard display name for the provider
portals.$.providers.$.openIDConnect.clientIDstringClient ID for the OpenID Connect applicationRequired
portals.$.providers.$.openIDConnect.clientSecretstringClient secret for the OpenID Connect application
This is required when not using client assertions.
Required
portals.$.providers.$.openIDConnect.clientSecretFilestringFile containing the client secret for the OpenID Connect application
This is an alternative to passing the secret as clientSecret
portals.$.providers.$.openIDConnect.tokenIssuerstringOpenID Connect token issuer
The OpenID Connect configuration document will be fetched at <token-issuer>/.well-known/openid-configuration
Required
portals.$.providers.$.openIDConnect.clientAssertionstringEnables the usage of client assertions (also known as “Federated Identity Credentials” or “Federated Workload Credentials”) to obtain assertions for OpenID Connect clients.
This is an alternative to using client secrets, when the application is running in an environment that supports other ways to obtain federated credentials.
Currently, these values are supported:

- AzureManagedIdentity: uses Azure Managed Identity with a system-assigned identity
- AzureManagedIdentity=client-id: uses Azure Managed Identity with a user-assigned identity whose client id is “client-id” (e.g. AzureManagedIdentity=00000000-0000-0000-0000-000000000000)
- AzureWorkloadIdentity: uses Azure Workload Identity, e.g. in Kubernetes
- KubernetesServiceAccountToken=path: uses a token read from a Kubernetes service account token file. If path is omitted, defaults to /var/run/secrets/kubernetes.io/serviceaccount/token.
- tsiam=endpoint: uses tsiam to obtain Workload Identity from nodes that use Tailscale. Specify the endpoint of tsiam as value, e.g. tsiam=https://tsiam. Uses as resource name the value of tokenIssuer.
portals.$.providers.$.openIDConnect.requestTimeoutdurationTimeout for network requests for OpenID Connect authDefault: “10s”
portals.$.providers.$.openIDConnect.scopesstringOAuth2 scopes to requestDefault: “openid profile email”
portals.$.providers.$.openIDConnect.enablePKCEbooleanIf true, enables the use of PKCE during the code exchange.Default: false
portals.$.providers.$.openIDConnect.tlsInsecureSkipVerifybooleanIf true, skips validating TLS certificates when connecting to the OpenID Connect Identity Provider.Default: false
portals.$.providers.$.openIDConnect.tlsCACertificatePEMstringOptional PEM-encoded CA certificate to trust when connecting to the OpenID Connect Identity Provider.
portals.$.providers.$.openIDConnect.tlsCACertificatePathstringOptional path to a CA certificate to trust when connecting to the OpenID Connect Identity Provider.
portals.$.providers.$.openIDConnect.iconstringOptional icon for the provider
Defaults to the standard icon for the provider
portals.$.providers.$.openIDConnect.colorstringOptional color scheme for the provider
Allowed values include all color schemes available in Tailwind 4
Defaults to the standard color for the provider

Example:

portals:
  name: "default"
  providers:
    -
        openIDConnect:
          #name: "my-openid-auth"
          #displayName: "OpenID Connect"
          clientID: "your-client-id"
          clientSecret: "your-client-secret"
          #clientSecretFile: "/var/run/secrets/traefik-forward-auth/openidconnect/client-secret"
          tokenIssuer: "https://id.external-example.com"
          #clientAssertion: ""
          ## Default: "10s"
          #requestTimeout: "10s"
          ## Default: "openid profile email"
          #scopes: "openid profile email"
          ## Default: false
          #enablePKCE: false
          ## Default: false
          #tlsInsecureSkipVerify: false
          #tlsCACertificatePEM: ""
          #tlsCACertificatePath: ""
          #icon: "openid"
          #color: "pink"

Using Pocket ID#

NameTypeDescription
portals.$.providers.$.pocketID.namestringName of the authentication provider
Defaults to the name of the provider type
portals.$.providers.$.pocketID.displayNamestringOptional display name for the provider
Defaults to the standard display name for the provider
portals.$.providers.$.pocketID.endpointstringPocket ID server endpointRequired
portals.$.providers.$.pocketID.clientIDstringClient ID for the client applicationRequired
portals.$.providers.$.pocketID.clientSecretstringClient secret for the client applicationRequired
portals.$.providers.$.pocketID.clientSecretFilestringFile containing the client secret for the client application
This is an alternative to passing the secret as clientSecret
portals.$.providers.$.pocketID.requestTimeoutdurationTimeout for network requests for Pocket ID authDefault: “10s”
portals.$.providers.$.pocketID.scopesstringOAuth2 scopes to requestDefault: “openid profile email groups”
portals.$.providers.$.pocketID.enablePKCEbooleanIf true, enables the use of PKCE during the code exchange.Default: false
portals.$.providers.$.pocketID.clientAssertionstringEnables the usage of client assertions (also known as “Federated Identity Credentials” or “Federated Workload Credentials”) to obtain assertions for client applications.
This is an alternative to using client secrets, when the application is running in an environment that supports other ways to obtain federated credentials.
Currently, these values are supported:

- AzureManagedIdentity: uses Azure Managed Identity with a system-assigned identity
- AzureManagedIdentity=client-id: uses Azure Managed Identity with a user-assigned identity whose client id is “client-id” (e.g. AzureManagedIdentity=00000000-0000-0000-0000-000000000000)
- AzureWorkloadIdentity: uses Azure Workload Identity, e.g. in Kubernetes
- KubernetesServiceAccountToken=path: uses a token read from a Kubernetes service account token file. If path is omitted, defaults to /var/run/secrets/kubernetes.io/serviceaccount/token.
- tsiam=endpoint: uses tsiam to obtain Workload Identity from nodes that use Tailscale. Specify the endpoint of tsiam as value, e.g. tsiam=https://tsiam. Uses as resource name the value of endpoint.
portals.$.providers.$.pocketID.tlsInsecureSkipVerifybooleanIf true, skips validating TLS certificates when connecting to the Pocket ID server.Default: false
portals.$.providers.$.pocketID.tlsCACertificatePEMstringOptional PEM-encoded CA certificate to trust when connecting to the Pocket ID server.
portals.$.providers.$.pocketID.tlsCACertificatePathstringOptional path to a CA certificate to trust when connecting to the Pocket ID server.
portals.$.providers.$.pocketID.iconstringOptional icon for the provider
Defaults to the standard icon for the provider
portals.$.providers.$.pocketID.colorstringOptional color scheme for the provider
Allowed values include all color schemes available in Tailwind 4
Defaults to the standard color for the provider

Example:

portals:
  name: "default"
  providers:
    -
        pocketID:
          #name: "my-pocketid-auth"
          #displayName: "Pocket ID"
          endpoint: "https://pocketidid.example.com"
          clientID: "your-client-id"
          clientSecret: "your-client-secret"
          #clientSecretFile: "/var/run/secrets/traefik-forward-auth/pocketid/client-secret"
          ## Default: "10s"
          #requestTimeout: "10s"
          ## Default: "openid profile email groups"
          #scopes: "openid profile email groups"
          ## Default: false
          #enablePKCE: false
          #clientAssertion: ""
          ## Default: false
          #tlsInsecureSkipVerify: false
          #tlsCACertificatePEM: ""
          #tlsCACertificatePath: ""
          #icon: "pocketid"
          #color: "zinc"

Using Tailscale Whois#

NameTypeDescription
portals.$.providers.$.tailscaleWhois.namestringName of the authentication provider
Defaults to the name of the provider type
portals.$.providers.$.tailscaleWhois.displayNamestringOptional display name for the provider
Defaults to the standard display name for the provider
portals.$.providers.$.tailscaleWhois.allowedTailnetstringIf non-empty, requires the Tailnet of the user to match this value
portals.$.providers.$.tailscaleWhois.requestTimeoutdurationTimeout for network requests for Tailscale Whois authDefault: “10s”
portals.$.providers.$.tailscaleWhois.capabilityNameslist of stringsNames of capabilities to read from Tailscale peer capabilities.
Each capability name must be a URL-like string with a hostname and path (e.g., “example.com/capability”).
If a capability has an https:// prefix, it will be removed. http:// prefixes are not allowed.
Default: [“italypaleale.me/traefik-forward-auth”]
portals.$.providers.$.tailscaleWhois.iconstringOptional icon for the provider
Defaults to the standard icon for the provider
portals.$.providers.$.tailscaleWhois.colorstringOptional color scheme for the provider
Allowed values include all color schemes available in Tailwind 4
Defaults to the standard color for the provider

Example:

portals:
  name: "default"
  providers:
    -
        tailscaleWhois:
          #name: "my-tailscale-whois-auth"
          #displayName: "Tailscale Whois"
          #allowedTailnet: "yourtailnet.ts.net"
          ## Default: "10s"
          #requestTimeout: "10s"
          ## Default: ["italypaleale.me/traefik-forward-auth"]
          #capabilityNames: ["italypaleale.me/traefik-forward-auth"]
          #icon: "tailscale"
          #color: "slate"
Edit this page on GitHub