Fail to custom errors pages

I am trying to build a simple usecase with errors page to customize 502 and 401 for my team.

I'have this containers :

  • Traefik 2.0
    -- middlewares auth-basic (test/test)
    -- middlewares error-page
    -- middlewares secured is chained (auth-basic + error-page)
  • Apache with custom errors pages (404.html, 401.html, 502.html...)
  • Whoaim 1 whoami1.docker.localhost
  • Whoaim 2 whoami2.docker.localhost

My custom dns record is set on my host file.

All of my containers started, no errors in the Traefik api dashboard.

When i'am trying to generate custom error page, but the container serve /htdocs folder content.

To generate expected custom 404 or 502 use localhost or unknown url
To generate expected custom 401 faild login with escape

Doc : https://docs.traefik.io/v2.0/middlewares/errorpages/

Here is my test file

# docker-compose.yml
version: '3'

networks:
  proxy:
    external: true

services:
  reverse-proxy:
    # The official v2.0 Traefik docker image
    image: traefik:v2.0
    # Enables the web UI and tells Traefik to listen to docker
    networks:
      - proxy
    ports:
      # The HTTP port
      - 80:80
      - 443:433
      # The Web UI localhost:8080 (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
    command:
      - --log.level=DEBUG
      - --api.insecure=true
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.secured.chain.middlewares=app-basic-auth,error-page"
      - "traefik.http.middlewares.app-basic-auth.basicauth.users=test:$$apr1$$8nyeo2br$$eaGzBj0gKvjNiu7Ch7vl3." # test : test (use escape for generate 401 hope custome page)
      - "traefik.http.middlewares.error-page.errors.status=400-599"
      - "traefik.http.middlewares.error-page.errors.service=error-page@docker"
      - "traefik.http.middlewares.error-page.errors.query=/{status}.html"

  # Container used to serve custom error page to replace 502 Bad gateway error with a awesome page.
  # If you try localhost or unknown url, this container serve content in /htdocs but don't serve 404.html or others curtom page. I think have missed something.
  apache-error-page:
    image: httpd:alpine
    container_name: apache-error-page
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    volumes:
      # [!] create this folder with some html page for testing
      - ./errors:/usr/local/apache2/htdocs/ #contain my custom errors pages 401.html 404.html 502.html ...
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.error-page.loadbalancer.server.port=80"

  whoami1:
    image: containous/whoami
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami1.rule=Host(`whoami1.docker.localhost`)"
      - "traefik.http.routers.whoami1.middlewares=secured@docker"
      - "traefik.http.routers.whoami1.entrypoints=web"
  whoami2:
    image: containous/whoami
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami2.rule=Host(`whoami2.docker.localhost`)"
      - "traefik.http.routers.whoami2.middlewares=secured@docker"
      - "traefik.http.routers.whoami2.entrypoints=web"

Thanks for your help

the service name and the service accessed by the middleware do not have the same name