简体   繁体   English

Varnish Cache不会做ESI包括

[英]Varnish Cache will not do ESI include

I am having problems getting even the simplest of Varnish Cache ESI tests to work. 即使是最简单的Varnish Cache ESI测试也无法正常工作。
After trying and trying I thought I ask here. 经过尝试和尝试,我想我在这里问。

Basically it just wont include the ESI file. 基本上它只是不包括ESI文件。 It's just returning the HTML without doing it's include. 它只是返回HTML而不做它的包含。

Here is my varnish start command: 这是我的varnish start命令:

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: 这是我正在测试的URL:

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

My vcl rules: 我的vcl规则:

1) default.vcl 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 sample test esi code 我的示例测试esi代码

2) test.php 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>  

The php to esi include php到esi包括

3) esi_1.php 3)esi_1.php

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

I've tried many variations of the above vcl rules. 我已尝试过上述vcl规则的许多变体。
All don't work. 一切都行不通。 Just can't see where I'm going wrong? 只是看不出我哪里出错了?

Any advise/help much appreciated. 任何建议/帮助非常感谢。

Thank you. 谢谢。

The problem is Varnish and mod_deflate don't work together well at this time. 问题是Varnish和mod_deflate在这个时候不能很好地协同工作。

Removing deflate.conf and deflate.load fixed the problem. 删除deflate.conf和deflate.load修复了问题。

Cheers. 干杯。

Try testing with Varnish 3.0 beta1. 尝试使用Varnish 3.0 beta1进行测试。 One of its main new features is full compression support (which means that it now works also with ESI): 它的一个主要新功能是完全压缩支持(这意味着它现在也适用于ESI):

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

With that you'll probably avoid changing anything on your apache/php compression handling settings. 有了这个,你可能会避免在你的apache / php压缩处理设置上改变任何东西。

For Varnish 3.x 对于Varnish 3.x

in vcl_fetch, I had to add: 在vcl_fetch中,我不得不添加:

set beresp.do_esi = true;

Given the newest error, this blog post may be relevant . 鉴于最新的错误, 此博客文章可能是相关的

It seems that certain versions of Varnish don't handle gzipped content well. 似乎某些版本的Varnish不能很好地处理gzip压缩内容。 Do you have PHP set to perform gzip compression? 你有PHP设置来执行gzip压缩吗? Do you have the web server software hosting PHP set to perform gzip compression? 你有托管PHP设置的网络服务器软件来执行gzip压缩吗?

Varnish also can choke over poorly-formed content, though that doesn't seem to be likely here... Varnish也可以扼杀形成不良的内容,虽然这似乎不太可能......

Unfortunately I'm now out of ideas. 不幸的是,我现在没有想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM