traefik-oidc-auth: HTTP error 500

I am very excited about your project. Valuable addition to Traefik plugins.

I tried to configure it and only got that far. I’m testing with Traefik’s dashboard and using a standalone Traefik instance (no docker). I get only “HTTP GET error” displayed on access of the dashboard URL.

Firefox web developer tools give me:

GET https://traefik.<RedactedDomain>/dashboard/

Status 500
Version HTTP/2
Übertragen  181 B (15 B Größe)
Anfrage-Priorität Highest
DNS-Auflösung System

I don’t see any signs, that the OIDC plugin is invoked as a middleware at all. To make sure everything else is OK I also tested using basic-auth: this shows up in the Traefik logs and the dashboard is displayed. Testing my Keycloak instance (directly, without Traefik) using OpenID Connect Debugger also succeeds without errors.

Middleware configuration (snippet) - taken almost completely from your project:

    middlewares-keycloak-auth:
      plugin:
        traefik-oidc-auth:
          LogLevel: DEBUG
          Provider:
            Url: "https://keycloak.<RedactedDomain>:8443/realms/<RedactedRealmName>/protocol/openid-connect/auth"
            ClientId: "traefik-dashboard"
            ClientSecret: "<RedactedSecret>"
            # UsePkce: true # Use PKCE if your Provider supports this
          Scopes: ["openid", "profile", "email"]
          Headers:
            - Name: "X-Oidc-Username"
              Value: "{{`{{ .claims.preferred_username }}`}}"
            - Name: "X-Oidc-Subject"
              Value: "sub"
            - Name: "Authorization"
              Value: "{{`Bearer {{ .accessToken }}`}}"
          AuthorizationHeader:
            Name: "CustomAuth"
          AuthorizationCookie:
            Name: "CustomAuth"

Router configuration (snippet):

  routers:
    dashboard:
      entryPoints:
        - websecure
      rule: Host(`traefik.<RedacteDomain>`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))
      priority: 1
      service: api@internal
      middlewares:
        # Basic auth for tests
        # - middlewares-basic-auth@file
        # Keycloak auth
        - middlewares-keycloak-auth
      # Enforce TLS and apply my "default" TLS options (defined in default-tls@file) 
      tls: {}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28 (15 by maintainers)

Most upvoted comments

The middleware must also wrap the /oidc/callback path

On Mon, Jan 20, 2025 at 11:38 AM cowegner @.***> wrote:

I am very excited about your project. Valuable addition to Traefik plugins.

I tried to configure it and only got that far. I’m testing with Traefik’s dashboard and using a standalone Traefik instance (no docker). I get only “HTTP GET error” displayed on access of the dashboard URL.

Firefox web developer tools give me:

GET https://traefik.<RedactedDomain>/dashboard/

Status 500 Version HTTP/2 Übertragen 181 B (15 B Größe) Anfrage-Priorität Highest DNS-Auflösung System

I don’t see any signs, that the OIDC plugin is invoked as a middleware at all. To make sure everything else is OK I also tested using basic-auth: this shows up in the Traefik logs and the dashboard is displayed. Testing my Keycloak instance (directly, without Traefik) using OpenID Connect Debugger also succeeds without errors.

Middleware configuration (snippet) - taken almost completely from your project:

middlewares-keycloak-auth:
  plugin:
    traefik-oidc-auth:
      LogLevel: DEBUG
      Provider:
        Url: "https://keycloak.<RedactedDomain>:8443/realms/<RedactedRealmName>/protocol/openid-connect/auth"
        ClientId: "traefik-dashboard"
        ClientSecret: "<RedactedSecret>"
        # UsePkce: true # Use PKCE if your Provider supports this
      Scopes: ["openid", "profile", "email"]
      Headers:
        - Name: "X-Oidc-Username"
          Value: "{{`{{ .claims.preferred_username }}`}}"
        - Name: "X-Oidc-Subject"
          Value: "sub"
        - Name: "Authorization"
          Value: "{{`Bearer {{ .accessToken }}`}}"
      AuthorizationHeader:
        Name: "CustomAuth"
      AuthorizationCookie:
        Name: "CustomAuth"

Router configuration (snippet):

routers: dashboard: entryPoints: - websecure rule: Host(traefik.<RedacteDomain>) && (PathPrefix(/api) || PathPrefix(/dashboard)) priority: 1 service: @.*** middlewares: # Basic auth for tests # - @.*** # Keycloak auth - middlewares-keycloak-auth # Enforce TLS and apply my “default” TLS options (defined in @.***) tls: {}

— Reply to this email directly, view it on GitHub https://github.com/sevensolutions/traefik-oidc-auth/issues/60, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3NZZWXYCCOKZ5ZB4QAUT2LUQ65AVCNFSM6AAAAABVQYIN7CVHI2DSMVQWIX3LMV43ASLTON2WKOZSG44TSOBTGIZTINA . You are receiving this because you are subscribed to this thread.Message ID: @.***>