Cache varnish will not include ESI

I'm having problems getting the easiest of the lacquer cache ESI tests to work.
After trying and trying, I thought I was asking here.

Basically it just does not include the ESI file. It simply returns HTML without including it.

Here is my varnish launch command:

varnishd -f /etc/varnish/default.vcl -s malloc,128M -T 127.0.0.1:2000 -a 0.0.0.0:8080; 

Here is the URL I'm testing with:

 http://vbox.local:8080/varnish-tests/test.php 

My vcl rules:

1) default.vcl

 backend default { .host = "127.0.0.1"; .port = "80"; } sub vcl_fetch { if (req.url ~ "test.php") { esi; /* Do ESI processing */ set beresp.ttl = 24h; } elseif (req.url ~ "esi_1.php") { set beresp.ttl = 1m; } return(deliver); } 

My esi test code

2) test.php

 <html> <head> <?php echo "Time 1: ".time(); ?> <br /> The time 2 is: <esi:include src="/varnish-tests/esi_1.php"/> at this very moment. </body> </html> 

Php for esi includes

3) esi_1.php

 <?php echo "Time 2: ".time(); ?> 

I have tried many variations of the above vcl rules.
All do not work. I just don’t see where I am mistaken?

Any recommendation / help is greatly appreciated.

Thanks.

+4
source share
4 answers

The problem is that Varnish and mod_deflate are not working well at this time.

Removing deflate.conf and deflate.load fixes the problem.

Greetings.

+5
source

Try testing with Varnish 3.0 beta1. One of its main functions is support for full compression (which means that now it also works with ESI):

https://www.varnish-software.com/blog/varnish-cache-30-beta-1-out

With this, you probably cannot change anything in your apache / php compression processing settings.

+1
source

Given the latest mistake, this blog post may be appropriate .

It seems that some versions of Varnish do not cope with gzip content. Do you have PHP installed to perform gzip compression? Do you have a PHP server hosting to do gzip compression?

Lac can also choke on poorly-formed content, although it doesn't seem to be so ...

Unfortunately, I now have no ideas.

0
source

For varnish 3.x

In vcl_fetch, I had to add:

 set beresp.do_esi = true; 
0
source

Source: https://habr.com/ru/post/1346170/


All Articles