Traefik Error Pages | errorpages-demo

submited by
Style Pass
2021-06-09 10:30:07

This blog post explains in detail how to set up two traefik services and errors middleware in order to show your users a custom 404 Not Found page on any URL unknown to traefik, as well as custom pages for any status codes that you desire on your other services.

At my startup Unseen Bio, we recently had a need to display a more friendly page to our customers in the rare occasion that one of our services is down. We use the very enjoyable traefik reverse proxy and load balancer so I took a look at the documentation for the errors middleware. That gave me a good idea of what had to be done but there’s nothing better than a working example, right? After a brief search I landed on three pages that got me most of the way: a post by Andrea Mignone, another by Nicholas Dille, and a Docker image with custom error pages with a ready-made traefik configuration.

Why do I say that they took me most of the way? All three suggest the same basic strategy: Introduce a service that matches any URL with a low priority such that any existing service takes precedence when traefik routes a request. With Docker labels, the configuration might look as follows.

Leave a Comment