【发布时间】:2015-07-11 14:25:04
【问题描述】:
我正在尝试使用 varnish 缓存 2 个网站:
我配置了 2 个 DNS 条目:nodejs-proxy 和 gradle-proxy
在我的浏览器中,如果我访问 http://gradle-proxy,我会被重定向到 services.gradle.org 的清漆缓存网站。所以这部分有效。
但是,当我转到http://nodejs-proxy 时,如何配置它以使我的清漆机器只缓存和显示http://nodejs.org/dist/?
我的 default.vcl 配置是:
backend gradle {
.host = "207.223.250.8";
.port = "80";
.connect_timeout = 6000s;
.first_byte_timeout = 6000s;
.between_bytes_timeout = 6000s;
}
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.
if (req.http.host == "gradle-proxy.corp.appdynamics.com") {
set req.backend_hint = gradle;
}
if (! req.url ~ "^/dist/") {
return(pass);
}
return(lookup);
}
谢谢
【问题讨论】:
标签: caching proxy varnish varnish-vcl