Skip to main content

Posts

Featured

Using varnish cookies to set up a/b test

sub vcl_recv {  if (req.http.host == "www.domain.tld" && req.url ~ "^/pagename" && ! req.http.Cookie ~ "abtestpagename") {   if (std.random(1, 100)>50) {     set req.http.Cookie = "abtestpagename=newversion; Max-Age=xxxx; Path=/";   } else {     set req.http.Cookie = "abtestpagename=original; Max-Age=xxx; Path=/";   }  set req.http.X-Cookie-ab-test-pagename = req.http.Cookie; }  if (req.http.host == "www.domain.tld" && req.url ~ "^/pagename" && req.http.Cookie ~ "abtestpagename=newversion") {   set req.url = "/newpagename/";  } //Other stuff that may include cookie cleanup for cache hit rate increase } sub vcl_deliver {  if (req.http.X-Cookie-ab-test-pagename) {   set resp.http.Set-Cookie = req.http.X-Cookie-ab-test-pagename;  } }

Latest Posts

Ubiquti USG unifi security gateway adopt settings via ssh cli command line for parental control purposes

Install and configure firewall on CentOS

PHP xdebug Problem Ubuntu 10.4 Lucid Lynx

Monitor DRBD state with bash shell script

SpamAssassin 3.3.0 on Ubuntu Karmic 9.10

vnstat on OpenBSD self compiled

ClassNotFoundException XPrintable - GroupLayout

Windows 7 "copy to" user profile button disabled

eye candy theme for karmic koala 9.10

Integrate BBClone in Typo3