Apache 清漆4透明地重写URL

Apache 清漆4透明地重写URL,apache,.htaccess,varnish,varnish-vcl,varnish-4,Apache,.htaccess,Varnish,Varnish Vcl,Varnish 4,我正在看一个网站,目前正在运行一个相当标准的varnish/apache设置。客户端需要添加一个新域,该域通过路径/查询字符串透明地提供服务,以便创建其站点的轻量级版本。例如: 用户访问mobile.example.com,它指向与example.com相同的服务器 Varnish将mobile.example.com请求重写为example.com/mobile?theme=mobile 用户收到apache从example.com/mobile?theme=mobile提供的页面,但仍停留在

我正在看一个网站,目前正在运行一个相当标准的varnish/apache设置。客户端需要添加一个新域,该域通过路径/查询字符串透明地提供服务,以便创建其站点的轻量级版本。例如:

用户访问mobile.example.com,它指向与example.com相同的服务器

Varnish将mobile.example.com请求重写为example.com/mobile?theme=mobile

用户收到apache从example.com/mobile?theme=mobile提供的页面,但仍停留在mobile.example.com上

我们需要点击路径并在此处添加查询字符串,同时维护用户输入的任何路径,即:mobile.example.com/test应提供example.com/mobile/test?theme=mobile的内容

使用清漆4有什么建议吗?有可能吗?

成功了

if (req.http.host ~ "^mobile\.example\.com") {
  set req.http.host = "example.com";
  set req.url = regsub(req.url, "^/", "/mobile/");
  set req.url = regsub(req.url, "$", "?theme=mobile");
}