我的目标是将某些查询字符串属性及其值"白名单",以便清除不会改变网址之间的缓存.
例:
Url 1: http://foo.com/someproduct.html?utm_code=google&type=hello  
Url 2: http://foo.com/someproduct.html?utm_code=yahoo&type=hello  
Url 3: http://foo.com/someproduct.html?utm_code=yahoo&type=goodbye
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,我想将"utm_code"列入白名单,但不要"输入".因此,在第一个网址被点击后,我希望varnish将缓存的内容提供给第二个网址.
但是,在第三个url的情况下,属性"type"值不同,因此应该是清漆缓存未命中.
我已经尝试了下面的两种方法(在我现在找不到的drupal帮助文章中找到)似乎不起作用.可能是因为我有正则表达式错误.
# 1. strip out certain querystring values so varnish does not vary cache.
set req.url = regsuball(req.url, "([\?|&])utm_(campaign|content|medium|source|term)=[^&\s]*&?", "\1");
# get rid of trailing & or ?
set req.url = regsuball(req.url, "[\?|&]+$", "");
# 2. strip out certain querystring values so varnish does not vary cache.
set req.url = regsuball(req.url, "([\?|&])utm_campaign=[^&\s]*&?", "\1");
set req.url = regsuball(req.url, "([\?|&])foo_bar=[^&\s]*&?", "\1");
set req.url = regsuball(req.url, "([\?|&])bar_baz=[^&\s]*&?", "\1");
# get …Run Code Online (Sandbox Code Playgroud) 我花了一些试验和错误来弄清楚如何将AWS EFS mount命令转换为使用chef资源,所以我想我想分享.
亚马逊给出的命令:
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-01234567.efs.us-west-2.amazonaws.com:/ efs
Run Code Online (Sandbox Code Playgroud)