Traefik V3, How to Disable http and tcp ingress route temporarily and return 503 maintenance mode

89 Views Asked by At

I am currently using traefik v3 and i need to return 503 status code describing the service is in maintenance mode when there is a maintenance of the service.

how do i do it, found some results suggesting middleware change and annotating route but nothing works.

Thanks for helping.

1

There are 1 best solutions below

0
lsalazar On

To set up maintenance mode in Traefik v3, you can try using a custom middleware plugin from Traefik's plugin collection. You may check this out -

Traefik Maintenance Middleware Plugin

This Traefik middleware plugin allows you to configure maintenance responses for your routers. You have to declare the experimental block in your traefik static configuration file or add the required flags. Maintenance mode will be triggered if enabled is set to true and if the file configured for triggerFilename exists. It's also possible to provide a JSON (or any other) maintenance response by changing the filename to point to a JSON file and by changing httpContentType to application/json; charset=utf-8.