【发布时间】:2016-08-02 04:53:40
【问题描述】:
您好,我有以下问题。我有一个运行 laravel 5.1 的网站,为了使该网站可供许多用户使用,并获得更快的加载时间,我使用了 Varnish4。我的varnish vlc文件如下。
backend default {
.host = "127.0.0.1";
.port = "80";
}
sub vcl_recv {
# Happens before we check if we have this in cache already.
#
# Typically you clean up the request here, removing cookies you don't need,
# rewriting the request, etc.
unset req.http.Cookie;
}
sub vcl_backend_response {
unset beresp.http.Set-Cookie;
set beresp.do_esi = true;
set beresp.ttl = 1m;
return(deliver);
}
如您所见,我为所有请求启用了 esi processign(不是最佳做法,但我正在努力使事情正常进行),并删除 vcl_recv 子例程中的所有 cookie。
现在,我有一个带有 esi:include 块的刀片模板,如下所示:
<esi:remove>
NO ESI SUPPORT
<script>window.load_hot = true;</script>
</esi:remove>
<!--esi
<p>The full text of the license:
<esi:include src="http://localhost/date.php" />
</p>
-->
esi include 标签上的路由工作正常并返回预期的输出。 Varnish 系统按预期解析 ESI 块,因为未显示 fallback(show NO ESI SUPPORT) 消息。
那么,这段代码有什么问题呢?
【问题讨论】:
标签: php caching laravel-5 varnish varnish-vcl