A bunch of custom error pages for Traefik built with Jekyll.
Install dependencies
$ bundle install
If you want to build the project on your host:
$ jekyll build
If you want to preview the pages before building the Docker image :
$ jekyll serve
$ open http://127.0.0.1:4000/
Labels are already define in the image to work with Traefik.
To use it in production just run the container :
$ docker run -d --restart always romancin/traefik-custom-error-pages
This container will run with this labels by default:
labels:
- "traefik.http.routers.catchall_router.entrypoints=web"
- "traefik.http.routers.catchall_router.rule=HostRegexp(`{catchall:.*}`)"
- "traefik.http.routers.catchall_router.priority=1"
- "traefik.http.routers.catchall_router.service=catchall_service@docker"
- "traefik.http.routers.catchall_router_ssl.entrypoints=websecure"
- "traefik.http.routers.catchall_router_ssl.rule=HostRegexp(`{catchall:.*}`)"
- "traefik.http.routers.catchall_router_ssl.priority=1"
- "traefik.http.routers.catchall_router_ssl.tls=true"
- "traefik.http.routers.catchall_router_ssl.service=catchall_service@docker"
- "traefik.http.middlewares.errorpage.errors.status=400-599"
- "traefik.http.middlewares.errorpage.errors.service=catchall_service@docker"
- "traefik.http.middlewares.errorpage.errors.query=/{status}.html"
- "traefik.http.services.catchall_service.loadbalancer.server.port=80"
To use it, on the container that you want to use the "errorpage" middleware, add:
labels:
- "traefik.http.routers.myrouter.middlewares=errorpage"
This is a multi-stage build, to build the final image:
$ docker build -f .cloud/docker/Dockerfile -t traefik-custom-error-pages .
As you can see in the Dockerfile, I use Nginx as Web server to serve static files. To generate this pages, I use Jekyll in the first step of the build.
For traefik, I hardcoded Labels in the Dockerfile.
It's very useful because this container will respond to all requests only if there is no container with a real rule.
Thanks to guillaumebriday for creating the project and Jakob-em for forking it to apply inline files for css and svg.
Do not hesitate to contribute to the project by adapting or adding features ! Bug reports or pull requests are welcome.
This project is released under the MIT license.