I want to redirect all requests to https and in addition catch all requests to an unavailable service and redirect them to a custom error page (similar to Using #traefik error pages to handle unavailable services · Nicholas Dille) but I just can't get both to work.
When both are enabled, only the redirect to https works but then the regular 404 is returned for a service that does not exist.
If I disable the redirect to https, the error redirect works as expected.
This is my current setup:
traefik.toml
[providers]
[providers.docker]
watch = true
network = "public"
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.http.redirections]
[entryPoints.http.http.redirections.entryPoint]
to = "https"
scheme = "https"
[entryPoints.https]
address = ":443"
[api]
dashboard = true
insecure = true
docker-compose.yml
version: '3'
services:
reverse-proxy:
# The official v2 Traefik docker image
build:
context: ./traefik
dockerfile: Dockerfile
networks:
- public
ports:
# The HTTP port
- "80:80"
- "443:443"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- config:/etc/traefik/config/
error:
image: some-nginx-server/with-error-pages
networks:
public:
labels:
traefik.http.middlewares.traefik-errors.errors.status: 404,500,501,503,504
traefik.http.middlewares.traefik-errors.errors.service: catch-all
traefik.http.middlewares.traefik-errors.errors.query: /{status}.html
traefik.http.routers.catch-all.rule: HostRegexp(`{host:.+}`)
traefik.http.services.catch-all.loadbalancer.server.port: 80
traefik.http.routers.catch-all.priority: 1
traefik.enable: "true"
networks:
public:
volumes:
config: