Redirect to https and redirect all requests to unavailable services to custom error page

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:


    watch = true
    network = "public"

  address = ":80"
        to = "https"
        scheme = "https"
  address = ":443"

  dashboard = true
  insecure = true


version: '3'

    # The official v2 Traefik docker image
      context: ./traefik
      dockerfile: Dockerfile
      - public
      # The HTTP port
      - "80:80"
      - "443:443"
      # The Web UI (enabled by --api.insecure=true)
      - "8080:8080"
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock
      - config:/etc/traefik/config/

    image: some-nginx-server/with-error-pages
      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:.+}`) 80
      traefik.http.routers.catch-all.priority: 1
      traefik.enable: "true"



You can do the redirect on entrypoint. See simple Traefik example (link).

Make sure to assign the error middlewares to the services you want it to use (doc).

The first link, as far as I understand it, does exactly what I am doing in my posted traefik configuration. The second answer unfortunately misses the point of my question. I don't want to redirect the response of a specific service to my error middleware (I allready know how to do that and it works fine). I want to redirect requests to non existent services (e.g. when a service is restarting) similar to this: Using #traefik error pages to handle unavailable services · Nicholas Dille
as I mentioned this already works if I disable the https redirection but I want it to work on top of the https redirection.

Have you tried placing the error middleware on the entrypoint (doc)?

Tried it out yesterday but unfortunately leads to the same issue :confused: