File provider configuration¶
Enable the File provider in Traefik¶
providers:
file:
filename: /etc/traefik/traefik-file.yml
Configure the forwardauth middleware¶
See also
################################################################
# File Provider
#
# The definition of the router and service for auth.example.test
# and the url set to http://host.docker.internal:8080 to be used
# when running ForwardAuth externally from Docker Compose to be
# able to run ForwardAuth during development in an development
# environment and the rest of the Docker Compose containers for
# testing of features.
#
# The ForwardAuth service must then be commented out in the
# docker-compose.yaml file and started manually on your computer
# for example in IntelliJ IDEA or another IDE where the code
# is written.
################################################################
http:
routers:
routerAuth:
rule: "Host(`auth.example.test`)"
service: auth
entrypoints: "https"
tls: {}
services:
auth:
loadBalancer:
servers:
- url: http://172.17.0.1:8080
# for windows http://host.docker.internal:8080/authorize
middlewares:
https-redirect:
redirectScheme:
scheme: https
forward-auth:
forwardAuth:
# for windows http://host.docker.internal:8080/authorize
address: http://172.17.0.1:8080/authorize
trustForwardHeader: true
authResponseHeaders:
- authorization
- x-forwardauth-nickname
- x-forwardauth-family-name
- x-forwardauth-given-name
- x-forwardauth-name
- x-forwardauth-sub
- x-forwardauth-email
secured:
chain:
middlewares:
- forward-auth@file