fabiolb / fabio

Consul Load-Balancing made simple
https://fabiolb.net
MIT License
7.25k stars 620 forks source link

Custom behavior for the situation when the service has no healthy instances #898

Closed VladyslavLishchyna closed 1 year ago

VladyslavLishchyna commented 1 year ago

Hello everyone, please forgive me right away if my question is stupid or the answer has already been written before (I can’t find it, but I was looking for it). Is it possible in fabio to set a route to which the request will be redirected if there are no available services?

I mean the situation when services are registered for a certain path, but they have the status "unhealthy". In such a situation, I would like to redirect requests to a static page with information like "technical work is in progress, try again later".

Is there a way to do this with consul+fabio ?

aaronhurt commented 1 year ago

You can do this using the weight feature ... Implementation discussion here: https://github.com/fabiolb/fabio/issues/42 Docs here: https://fabiolb.net/cfg/

TLDR: Set w=100 on your consul services and register a fallback with w=0 the 0 service will only get traffic if the others are down.

VladyslavLishchyna commented 1 year ago

Thanks amazing solution