惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
D
Docker
腾讯CDC
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
IT之家
IT之家
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
博客园 - 【当耐特】

Varnish

varnish 如何根据 header 动态设置缓存时间 Varnish Explained varnish 4.1 和 5.0 现在( 2016 年 10 月 19 日)满满的都是坑别用 Varnish Cache 5.0 启用缓存后,大家如何解决网站即时显示新添加或修改的内容? Fastly 写的他们为什么用 Varnish 做 CDN 的理由 Varnish Massive Storage Engine Varnish/nginx 反向代理如何解决后端获取 server_addr 是 127.0.0.1 的问题 Varnish 一般是放在 Nginx 前面还是后面的? 求助:关于 varnish 配置的问题 VML Varnish Cache 4.0.0 varnish可以走ssl吗 怎么处理Varnish 动态输出?
大家帮忙看下这段 Varnish 缓存规则是什么原因导致的语法错误
boro · 2015-04-13 · via Varnish

试了下Varnish官方给出的一个缓存应用实例,结果得到了下面这个错误:
Message from VCC-compiler:
Syntax error at
('input' Line 29 Pos 17)
if (req.url ~ "\ (utm_ (campaign |? medium | source | term) | adParams | client | cx | eid | fbid | feed | ref (id | src) |? v (er | iew)) =" ) {
---------------- # --------------------------------- -------------------------------------------------- -------------------
Running VCC-compiler failed, exit 1
这个错在哪呢?
全部缓存规则如下:
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
if (req.http.Accept-Encoding) {
#revisit this list
if (req.url ~ "\.(gif|jpg|jpeg|swf|flv|mp3|mp4|pdf|ico|png|gz|tgz|bz2)(\?.*|)$") {
remove req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
remove req.http.Accept-Encoding;
}
}
if (req.url ~ "\.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(\?.*|)$") {
unset req.http.cookie;
set req.url = regsub(req.url, "\?.*$", "");
}
if (req.url ~ “\?(utm_(campaign|medium|source|term)|adParams|client|cx|eid|fbid|feed|ref(id|src)?|v(er|iew))=”) {
set req.url = regsub(req.url, “\?.*$”, “”);
}
if (req.http.cookie) {
if (req.http.cookie ~ "(wordpress_|wp-settings-)") {
return(pass);
} else {
unset req.http.cookie;
}
}
}
sub vcl_fetch {
if (req.url ~ "wp-(login|admin)" || req.url ~ "preview=true" || req.url ~ "xmlrpc.php") {
return (hit_for_pass);
}
if ( (!(req.url ~ "(wp-(login|admin)|login)")) || (req.request == "GET") ) {
unset beresp.http.set-cookie;
}
if (req.url ~ "\.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(\?.*|)$") {
set beresp.ttl = 365d;
}
}
sub vcl_deliver {
# multi-server webfarm? set a variable here so you can check
# the headers to see which frontend served the request
# set resp.http.X-Server = "server-01";
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
}