How to handle errors when using esi tags?
Dridi Boukelmoune
dridi at varni.sh
Wed Jul 13 09:37:02 UTC 2022
On Tue, Jul 12, 2022 at 9:50 PM Felipe Santiago
<jfelipe.sfilho at gmail.com> wrote:
>
> Hi,
>
> I've been trying to use <esi:include src="/foo" alt="/bar"/> to execute a subrequest to /bar in case /foo fails, however I didn't manage to make it work. Do you support the alt attribute? If my backend returns a 4xx or 5xx, is that considered an error?
Hi,
We don't support alternate URLs for ESI includes, and actually I'm
wondering how we could do it.
A 4xx or 5xx response is considered a response, so unless you abandon
the backend fetch, such a backend response will be included in the
client response.
Since Varnish 7.1 abort ESI delivery on include error:
https://varnish-cache.org/docs/7.1/whats-new/changes-7.1.html#other-changes-in-varnishd
> I also found in the documentation some references on how to do that using the esi:remove, but I didn't have success either. Any suggestions?
The <esi:remove> tag serves a completely different purpose.
Dridi
More information about the varnish-misc
mailing list