-
|
Hello! The title should be pretty clear. I've tried everything to redirect a subdomain to error-pages when Traefik respond with 404. But nothing is working. What I'm trying is: https://random-subdomain.domain.com --> custom 404 page from error-pages Here is my current setup (which is working for traefik.domain.com/random, for instance): services:
traefik:
container_name: traefik
env_file:
- .env
image: traefik:latest
labels:
traefik.enable: true
traefik.http.routers.traefik.tls: true
traefik.http.routers.traefik.rule: Host(`traefik.domain.com`)
traefik.http.routers.traefik.entrypoints: websecure
traefik.http.routers.traefik.tls.certresolver: letsencrypt
traefik.http.routers.traefik.service: api@internal
networks:
- reverse-proxy
restart: unless-stopped
volumes:
- ./letsencrypt:/letsencrypt
- ./config:/etc/traefik
- ./log:/var/log/
- /var/run/docker.sock:/var/run/docker.sock:ro
error-pages:
container_name: error-pages
depends_on:
- traefik
environment:
TEMPLATE_NAME: hacker-terminal
image: tarampampam/error-pages:latest
networks:
- reverse-proxy
labels:
traefik.enable: true
# use as "fallback" for any NON-registered services (with priority below normal)
traefik.http.routers.error-pages.rule: HostRegexp(`{host:.+}`)
traefik.http.routers.error-pages.priority: 10
traefik.http.routers.error-pages.tls: true
traefik.http.routers.error-pages.entrypoints: web, websecure
# "errors" middleware settings
traefik.http.middlewares.error-pages.errors.status: 400-599
traefik.http.middlewares.error-pages.errors.service: error-pages
traefik.http.middlewares.error-pages.errors.query: /{status}.html
# define service properties
traefik.http.routers.error-pages.service: error-pages
traefik.http.services.error-pages.loadbalancer.server.port: 8080
restart: unless-stopped
networks:
reverse-proxy:
external: trueAny clue is welcomed! 🙏 |
Beta Was this translation helpful? Give feedback.
Answered by
dima-bzz
Jul 2, 2025
Replies: 1 comment 8 replies
-
|
You need to add middleware for traefik traefik.http.routers.traefik.middlewares: error-pages |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#275