On Fri, Apr 17, 2026 at 07:45:56AM +0000, Pierre Cheynier wrote: > Subject: RE: [PATCH v2] FEATURE: add sample conv for frontend existence check > Hello Willy, > > On Mon, Apr 13, 2026 at 20:09:17 +0200, Willy Tarreau wrote: > > > > Introduced a new sample fetch keyword "fe_exist" that checks if a > > > frontend with a given name exists. > > > > Thanks for this! I'm still having three small details: > > > > - actually this is a converter so we should adjust the description > > in the commit message. > > Indeed, I initially went into the wrong direction and only fixed the title, > fixed in v3. > > > - this should rather be named "fe_exists" since the verb is in the > > present tense (but that's a tiny detail we can adjust while merging). > > True, adjusted in v3 as well. > > > - I'm wondering if we shouldn't have the equivalent for a backend, > > especially with the introduction of dynamic backends. And then maybe > > it could turn to "proxy_type" which would return "frontend", "backend", > > nothing in case of not found, maybe something else. Note that it might > > not end up being a good idea (might be harder to use for listen vs > > frontend for example), just mentioning for completeness. > > Yes, we somehow used "nbsrv" that did the job correctly for backends (fails > silently - ie. returns 0 when the backend does not exist). This may not be > appropriate in all contexts though, but I had no idea to make it something > generic, except create a dedicated converter for each type of proxy.
You could use proxy_find_by_name() and just return proxy_type_str(proxy) or nothing if it didn't find anything. -- William Lallemand

