0
我有多个子域指向一个清漆实例。我在文档中读到应使用PCRE正则表达式。我相信我的下面的正则表达式应该在请求url为“http://internal.my.com/any/thing”并且应该设置15s ttl时返回true。我试过(req.url〜“internal.my.com”),因为我读过它应该匹配的请求url的任何部分包含该字符串。尽管向internal.my.com发出了请求,但下面的vcl_fetch子例程总是导致300s高速缓存。根据请求URL修改光油TTL
# Cache for a longer time if the internal.my.com URL isn't used
sub vcl_fetch {
if (req.url ~ "^[(http:\/\/)|(https:\/\/)]*internal\.my\.com.*"){
set beresp.ttl = 15 s;
} else {
set beresp.ttl = 300 s;
}
}