小编Jac*_*cob的帖子

Varnish Cache不会做ESI包括

即使是最简单的Varnish Cache ESI测试也无法正常工作.
经过尝试和尝试,我想我在这里问.

基本上它只是不包括ESI文件.它只是返回HTML而不做它的包含.

这是我的varnish start命令:

varnishd -f /etc/varnish/default.vcl -s malloc,128M -T 127.0.0.1:2000 -a 0.0.0.0:8080;
Run Code Online (Sandbox Code Playgroud)

这是我正在测试的URL:

http://vbox.local:8080/varnish-tests/test.php
Run Code Online (Sandbox Code Playgroud)

我的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);  
}  
Run Code Online (Sandbox Code Playgroud)

我的示例测试esi代码

2)test.php

<html>  
<head>  

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

<br />  

The time 2 is: <esi:include src="/varnish-tests/esi_1.php"/> at …
Run Code Online (Sandbox Code Playgroud)

php include varnish edge-side-includes

4
推荐指数
1
解决办法
4699
查看次数

标签 统计

edge-side-includes ×1

include ×1

php ×1

varnish ×1