Hi everyone, I am new to traefik, and I was facing a problem with query parameters and Forward Auth middleware,
the query parameters cannot be passed throw the auth server, and it is unclear to me.
I don't need to pass any headers, only ?access_token=123 in the URL.
services:
micro-token:
container_name: micro-token
build:
context: ./app
dockerfile: ./Dockerfile
command: uvicorn app.main:app --reload --host 0.0.0.0 --port 5000
volumes:
- .:/app/
ports:
- 5000:5000
networks:
traefik-network:
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-network"
- "traefik.http.routers.micro-token.entrypoints=web"
- "traefik.http.routers.micro-token.rule=Host(`auth.localhost`)"
- "traefik.http.middlewares.micro-token.forwardauth.address=http://auth.localhost/auth"
- "traefik.http.routers.micro-token.service=micro-token"
# - "traefik.http.middlewares.micro-token.forwardauth.authResponseHeaders=X-Forwarded-User"
- "traefik.http.middlewares.micro-token.forwardauth.trustForwardHeader=true"
- "traefik.http.services.micro-token.loadbalancer.passhostheader=true"
- "traefik.http.services.micro-token.loadbalancer.server.port=5000"
tileservergl:
build:
context: .
dockerfile: Dockerfile
ports:
- "7031:7021"
restart: always
volumes:
# - data:/data
- ./data:/data
# - styles:/app/node_modules/tileserver-gl-styles/styles
- ./styles:/app/node_modules/tileserver-gl-styles/styles
- fonts:/app/node_modules/tileserver-gl-styles/fonts
# - ./fonts:/app/node_modules/tileserver-gl-styles/fonts
- ./public:/app/public
env_file:
- .env
networks:
traefik-network:
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-network"
- "traefik.http.routers.tileservergl.entrypoints=web"
- "traefik.http.routers.tileservergl.rule=Host(`basemaps.localhost`)"
# - "traefik.http.middlewares.tileservergl.addprefix.prefix=/basemaps"
- "traefik.http.routers.tileservergl.middlewares=micro-token"
- "traefik.http.services.tileservergl.loadbalancer.passhostheader=true"
# - "traefik.http.routers.tileservergl.service=tileservergl"
- "traefik.http.services.tileservergl.loadbalancer.server.port=7021"
Dashboard
the microservice I want to protect:
simple auth server is OK :
when go to http://auth.localhost/auth?access_token=123
it returns status code 200 and everything ok with that
Thanks all