4

我想将客户端网址“www.example.com/download..”操作为“one.other.com/download ...但我希望客户端上的网址保持第一个”www.example.com/download "

Varnish 3有没有办法做到这一点?

4

1 回答 1

4

是的,您可以使用regsub()VCL 中的函数轻松完成vcl_recv

例如:

if (req.http.host ~ "^(www\.)?example\.com" && req.url~ "^/download/") {
  set req.http.host = "one.other.com";
  set req.url = regsub(req.url, "^/download/", "/");
} 

此示例重写对 http://www.example.com/download/example.jpg的访问 http://one.other.com/example.jpg。当然,它对用户是不可见的。

于 2013-02-14T16:09:13.467 回答