I'm struggling getting ESI includes to be replaced in a JSON context.
The following working correctly. Resulting in the ESI tag replaced by the actual contents.
<esi:include src="http://domain.com/esipath/" />
And this is not working. The ESI tag isn't replaced.
{
"test": "<esi:include src="http://domain.com/esipath/" />"
}
I have found some resources on google and a possible solution seems to set esi_syntax
to 0x3 for varnish to skip checking for valid XML.
This doesn't seem to work on Varnish 4. When I start the deamon with the runtime param I get the following error.
Error: Unknown parameter "esi_syntax".
Is this setting deprecated in Varnish 4?
Any ideas to get this working?
indeed that parameter is depricated in varnish4. What you have to do is to activate the feature ESI_DISABLE_XML_CHECK
.
For me I edit /etc/default/varnish
(debian based system) and add
-p feature=+esi_disable_xml_check
to the DEAMON_OPTS
parameters, for example:
DAEMON_OPTS="-a :6081 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,4GB \
-p feature=+esi_disable_xml_check"