Possible to disable/inactivate a backend using VCL?

Batanun B batanun at hotmail.com
Wed Apr 19 08:34:21 UTC 2023


Hi Guillaume,

> I'm curious, if it's completely deactivated what's the benefit of having it in the vcl?

It is only intended to be deactivated in production (until we go live). Our test and staging environments have the backend active.

> if (false) {
>   set req.backend_hint = you_deactivated_backend;
> }

Thanks, I will test this.
My current prod-specific setup for this backend looks like this:

backend theBackend {
    .host = "localhost";
    .port = "9999";
    .probe = {
        .interval = 1h;
    }
}

This seems to be working when testing it locally. It also solves the problem of having to assign some arbitrary ip or hostname (the actual backend host for this service hasn't been created in production yet, since we are several months away from go live), which actually was our main problem. What do you think about this approach instead? Preferably this would be a built in feature in Varnish, with a setting "disabled = true" or similar in the backend definition, and then it would not require any host or ip to be configured.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20230419/c7bb3240/attachment.html>


More information about the varnish-misc mailing list