-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Hello there!
I am trying to use this project instead of https://github.com/thomseddon/traefik-forward-auth. I succeed to do the connection with my oauth provider, but I am always been redirected to the auth host instead of the origin host.
I have:
- traefik as reverse proxy
- A web service
- A traefik-auth running on the current project
I need to protect some routes of my web service with traefik-auth.
Current Behavior
When accessing a protected endpoint (e.g., service.example.com/health), the authentication flow incorrectly redirects users to oauth.example.com/health after successful authentication instead of returning to the original URL.
Expected Behavior
After successful OAuth authentication, users should be redirected back to their original requested URL:
- Initial request to
service.example.com/health - Redirect to OAuth provider for authentication
- Return to auth callback endpoint
- Final redirect back to
service.example.com/health
Configuration
- traefik-auth
services:
traefik-auth:
build:
context: .
dockerfile: Dockerfile
env_file: .env
depends_on:
- traefik
labels:
- traefik.enable=true
- traefik.http.routers.traefik-auth-tls.entrypoints=https
- traefik.http.routers.traefik-auth-tls.tls=true
- traefik.http.routers.traefik-auth-tls.rule= Host(`oauth.example.com`)
- traefik.http.routers.traefik-auth.entrypoints=http
- traefik.http.services.traefik-auth.loadbalancer.server.port=4181
- traefik.http.middlewares.forward-auth.forwardauth.address=http://traefik-auth:4181
- traefik.http.middlewares.forward-auth.forwardauth.trustForwardHeader=true
- traefik.http.middlewares.forward-auth.forwardauth.authResponseHeaders=X-Forwarded-User
- traefik.http.routers.traefik-auth-tls.middlewares=forward-auth
- service
services:
service:
build:
context: .
dockerfile: Dockerfile
env_file: env
depends_on:
- postgres
- traefik
labels:
- traefik.enable=true
- traefik.http.routers.service.entrypoints=http
- traefik.http.routers.service-tls.entrypoints=https
- traefik.http.routers.service-tls.tls=true
- traefik.http.routers.service.middlewares=forward-auth
Thanks for your help.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels