Mailing List Archive

How to handle errors when using esi tags?
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?

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?

Thanks in advance.

Felipe Santiago
Re: How to handle errors when using esi tags? [ In reply to ]
On Tue, Jul 12, 2022 at 9:50 PM Felipe Santiago
<jfelipe.sfilho@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
_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc