I am running into an issue where there is a brief period as soon as traefik starts where the routes to my services return a 404 not found. I am working on a Rasberry Pi application and launch chromium pointing to traefik running on localhost so this is slightly outside of the standard use case. The problem is that chromium starts faster than traefik nearly 100% of the time and as soon as traefik is up, it responds with 404 not found.
Here is a docker compose file replicating my issue (Note similar to the file found here Basic Example - Traefik but using Path instead of Host)
version: "3.3" services: traefik: image: "traefik:v2.4" container_name: "traefik" depends_on: - "whoami" command: #- "--log.level=DEBUG" - "--api.insecure=true" - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" ports: - "80:80" - "8080:8080" volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" whoami: image: "traefik/whoami" container_name: "simple-service" labels: - "traefik.enable=true" - "traefik.http.routers.whoami.rule=Path(`/whoami`)" - "traefik.http.routers.whoami.entrypoints=web"
I was hoping that having a depends on would help, but it seems to be an issue where traefik is responding to requests, before it is discovering configuration from containers. I have also tried configuring traefik with a yml but run into the same issue.
My temporary workaround is to write a script to wait for a 200x response from my endpoint before launching chromium, but I was hoping there was a more elegant solution that could be done with tweaking traefik, some way to get it to wait before returning a 404 on startup, or wait until it is finished parsing configurations.
Thanks in advance for any help! Let me know if I should open an issue on Github.