When setting up traefik I run against an issue. I have a basic setup of traefik and authelia. Both work fine and can be accessed by their set domains, but when trying to add another service it gives a 404 error. I have all services setup using docker compose. They're all apart of the same compose. I have tried accessing the site with and without authelia as middleware both give the same result. Between changing the labels I had the flag --force-recreate
active for docker compose just to be sure. Also tried it without. The A records with my DNS provider are all set to the same local domain as I don't have any ports open at the moment. I'm also running a pi-hole on the same host, but that doesn't seem to be the problem as it gives the same result regardless if the pi-hole is active or not.
docker-compose.yml
secrets:
JWT_SECRET:
file: '$BASE_DIR/authelia/secrets/JWT_SECRET'
SESSION_SECRET:
file: '$BASE_DIR/authelia/secrets/SESSION_SECRET'
STORAGE_ENCRYPTION_KEY:
file: '$BASE_DIR/authelia/secrets/STORAGE_ENCRYPTION_KEY'
services:
traefik:
image: traefik:latest
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
#### Both declared in .env
#environment:
#- CF_API_EMAIL=
#- CF_DNS_API_TOKEN=
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik/data/traefik.yml:/traefik.yml:ro
- ./traefik/data/acme.json:/acme.json
- ./traefik/data/config.yml:/config.yml:ro
- $BASE_DIR/logs/traefik:/logs # Traefik logs
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=https"
- "traefik.http.routers.traefik.rule=Host(`traefik.ylvavalkyrja.xyz`)"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.routers.traefik.tls.certresolver=cloudflare"
- "traefik.http.routers.traefik.tls.domains[0].main=ylvavalkyrja.xyz"
- "traefik.http.routers.traefik.tls.domains[0].sans=*.ylvavalkyrja.xyz"
- "traefik.http.routers.traefik.service=api@internal"
include:
# - ./compose/sonarr.yml
- ./compose/authelia.yml
- ./compose/libreddit.yml
networks:
proxy:
external: true
authelia.yml
services:
authelia:
image: authelia/authelia
container_name: authelia
volumes:
- $BASE_DIR/authelia:/config
- $BASE_DIR/authelia/log:/var/log/authelia
networks:
- proxy
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.authelia.rule=Host(`auth.ylvavalkyrja.xyz`)'
- 'traefik.http.routers.authelia.entrypoints=https'
- 'traefik.http.routers.authelia.tls=true'
- 'traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://auth.ylvavalkyrja.xyz'
- 'traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true'
- 'traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email'
expose:
- 9091
restart: unless-stopped
environment:
TZ: $TZ
PUID: $PUID
GUID: $GUID
AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET_FILE: '/run/secrets/JWT_SECRET'
AUTHELIA_SESSION_SECRET_FILE: '/run/secrets/SESSION_SECRET'
AUTHELIA_STORAGE_ENCRYPTION_KEY_FILE: '/run/secrets/STORAGE_ENCRYPTION_KEY'
healthcheck:
disable: true
secrets:
- JWT_SECRET
- SESSION_SECRET
- STORAGE_ENCRYPTION_KEY
networks:
proxy:
external: true
configuration.yml for authelia
server:
host: 0.0.0.0
port: 9091
log:
level: info
format: text
file_path: /var/log/authelia/authelia.log
theme: dark
#identity_validation.reset_password.jwt_secret:
default_redirection_url: https://auth.ylvavalkyrja.xyz
totp:
issuer: authelia
authentication_backend:
password_reset:
disable: true
file:
path: /config/users_database.yml
password:
algorithm: argon2id
iterations: 1
salt_length: 16
parallelism: 8
memory: 64
access_control:
rules:
- domain:
- "*.ylvavalkyrja.xyz"
policy: two_factor
subject: "group:admins"
- domain: reddit.ylvavalkyrja.xyz
policy: two_factor
subject: "user:anon"
session:
name: authelia_session
#secret:
expiration: 8h
inactivity: 2h
domain: ylvavalkyrja.xyz # Your root domain
regulation:
max_retries: 3
find_time: 2m
ban_time: 5m
storage:
#encryption_key:
local:
path: /config/db.sqlite3
notifier:
filesystem:
filename: /config/notification.txt
libreddit.yml
services:
libreddit:
container_name: "libreddit"
image: spikecodes/libreddit
user: "1000:1000"
restart: unless-stopped
ports:
- 8080:8080
networks:
- proxy
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.libreddit.entrypoints=https'
- 'traefik.http.routers.libreddit.rule=Host(`libreddit.ylvavalkyrja.xyz`)'
- 'traefik.http.routers.libreddit.tls=true'
- 'traefik.http.services.libreddit.loadbalancer.server.port=8080'
- 'traefik.http.routers.libreddit.middlewares=authelia@docker'
networks:
proxy:
external: true
DNS settings
Hope I did all the formatting correctly and provided what is needed. If there is anything else please let me know.