wordpress - Varnish 的第一个请求的最大年龄= 0

标签 wordpress varnish

我让Varnish几乎可以使用Wordpress和Total Cache。

但是isvarnishworking.com告诉我age为0。有趣的是,如果我再次尝试使用相同的URL,那么一切正常,并且我可以看到age不再为0

它会为我尝试的每个网址执行此操作。我也可以在浏览器中验证这一点。

有什么可以解释的是,在第一个请求时(对于所有客户端),最大年龄为0,但从第二个请求开始,最大年龄是正常的?

我可以理解,如果清空了缓存,并且仅在第一次请求时才这样做。但是这里是每个客户的第一个请求。

vcl_recv:

# Drop any cookies sent to Wordpress.
 if (!(req.url ~ "wp-(login|admin)")) {
unset req.http.cookie;
 }

# Anything else left?
if (!req.http.cookie) {
 unset req.http.cookie;
}

vcl_fetch:
 # Drop any cookies Wordpress tries to send back to the client.
   if (!(req.url ~ "wp-(login|admin)")) {
    unset beresp.http.set-cookie;
    }

最佳答案

Varnish 标题“Age”与高速缓存控制参数“max-age”不同。这只是告诉您该对象刚刚进入缓存。 5s之后,您应该会看到“年龄:5”。

特别是从sec 14.6 of RFC 2616

The Age response-header field conveys the sender's estimate of the amount of time since the response (or its revalidation) was generated at the origin server. A cached response is "fresh" if its age does not exceed its freshness lifetime.

关于wordpress - Varnish 的第一个请求的最大年龄= 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35398900/

相关文章:

c - Varnish 4 + Pounds - 绕过特定 IP 地址的缓存

wordpress - 高级自定义字段和重力形式

javascript - 普通 JS : make 80% width element 100% IF contains an image

wordpress - WooCommerce REST Client API - 以编程方式获取消费者 key 和 secret

php - WordPress get_posts() 比较meta_query 中的时间戳问题

homebrew - 在 OSX 上 brew install varnish 之后,我在哪里可以找到配置文件来更改 DAEMON_OPTS

mysql - 使用 AND 的 WordPress 查询将数据返回为 OR

php - Nginx+php5-fpm+varnish+APC 上的 Wordpress 高 CPU 和内存使用率

php - 如何从 Varnish 缓存中删除 PHPSESSIONID

caching - varnish param.set 在服务重启后重置为以前的值