Created
October 3, 2014 18:20
-
-
Save sbeam/8658a0bb347bfb830221 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "#1030" | |
server s1 { | |
rxreq | |
expect req.url == "/test" | |
txresp | |
rxreq | |
expect req.url == "http://ovens.reviewed.com/" | |
txresp | |
rxreq | |
expect req.url == "/blah/foo?brand=foo&type=camera&page=5" | |
txresp | |
rxreq | |
expect req.url == "/blah/bar" | |
txresp | |
rxreq | |
expect req.url == "/blah/xyz" | |
txresp | |
rxreq | |
expect req.url == "/blah/quux" | |
txresp | |
rxreq | |
expect req.url == "/blah/potatoes?tags=Ice+Dispenser&page=42" | |
txresp | |
rxreq | |
expect req.url == "/how_we_test?brand=123&page=23" | |
txresp | |
rxreq | |
expect req.url == "http://dishwashers.reviewed.com/features/goodbye-granite-the-6-hottest-countertop-finishes" | |
txresp | |
rxreq | |
expect req.url == "http://refrigerators.reviewed.com/features/seriously-stop-refrigerating-these-foods" | |
txresp | |
rxreq | |
expect req.url == "http://ovens.reviewed.com/news/with-one-chip-ge-creates-diy-smart-appliances" | |
txresp | |
rxreq | |
expect req.url == "/content/lg-65ec9700-4k-oled-tv-first-impressions-review" | |
txresp | |
rxreq | |
expect req.url == "http://televisions.reviewed.com/features/the-ultimate-movie-player-starts-at-4000" | |
txresp | |
rxreq | |
expect req.url == "http://laundry.reviewed.com/" | |
txresp | |
rxreq | |
expect req.url == "/products/testing?brand=sam" | |
txresp | |
rxreq | |
expect req.url == "/features/bone-skulls-and-harmony-check-out-these-french-speakers" | |
txresp | |
rxreq | |
expect req.url == "/features/goodbye-granite" | |
txresp | |
rxreq | |
expect req.url == "/seriously-stop-refrigerating-these-foods" | |
txresp | |
rxreq | |
expect req.url == "http://laundry.reviewed.com/types/front-loading?page=1&_escaped_fragment_=" | |
txresp | |
rxreq | |
expect req.url == "/ads/interstitial_1?adid=stv_01" | |
txresp | |
rxreq | |
expect req.url == "http://www.reviewed.com/" | |
txresp | |
rxreq | |
expect req.url == "http://vacuums.reviewed.com//d/reviews/hoover-duros.htm?order_by=msrp%252Cdesc" | |
txresp | |
rxreq | |
expect req.url == "/ratings.htm?keywords=Daewoo+Steam+4.5CuFt+Washer%2C+7.3CuFt+GAS+Dryer+1%2C300+Spin+Speed%2C+Smart+Detergent+System&order_by=rating%2Cdesc" | |
txresp | |
rxreq | |
expect req.url == "/something.com/articles/12875/attachments.json?tags=Front+Photo%2CHandle+Photo%2CFingerprints+Photo%2CWater%2FIce+Dispenser+Photo%2CControls+Photo%2CWater%2FIce+Dispenser+Controls+Photo%2CInterior+Photo%2CRefrigerator+Main+1+Image%2CRefrigerator+Main+2+Image%2CRefrigerator+Main+3+Image%2CVegetable+Drawer+Photo%2CRefrigerator+Door+1-1+Image%2CIce+Maker+Photo%2CWater+Filter+Photo%2CRefrigerator+Door+2-1+Image%2CFreezer+Main+1+Image%2CFreezer+Door+1+Image%2CSides+Photo%2CBack+Photo&page=1&per_page=6" | |
txresp | |
rxreq | |
expect req.url == "/brands/hifiman?brand=hifiman" | |
txresp | |
} -start | |
varnish v1 -vcl+backend { | |
sub vcl_recv { | |
if( req.url ) { | |
# Header rewrite Fastly Header : 10 | |
set req.http.X-Reviewed-Fastly = "true"; | |
set req.url = regsuball(req.url, "(^|[?&]+)([^&/=]+(?:(&|$))|(?!_escaped_fragment_|brand|branch|type|min_msrp|max_msrp|_type|keywords|page|per_page|tags|name|order_by|adid|return_url|event|classifications|zip|website_ids)[^&/=]+=[^&]+)", "&"); | |
# Header rewrite remove extra pretzels : 11 | |
set req.url = regsuball(req.url, "&+", "&"); | |
# Header rewrite sweep up trailing pretzels and interros : 12 | |
set req.url = regsub(req.url, "[&?]+$", ""); | |
} | |
if( req.url ~ "&" && !(req.url ~ "\?") ) { | |
# Header rewrite ensure interro comes first : 13 | |
set req.url = regsub(req.url, "&", "?"); | |
} | |
} | |
} -start | |
client c1 { | |
txreq -url "/test" | |
rxresp | |
txreq -url "http://ovens.reviewed.com/?utm_source=VSW&utm_medium=PPC" | |
rxresp | |
txreq -url "/blah/foo?1234-1234_6&brand=foo&utm_source=1234&type=camera&page=5&utm_medium=blah&foo&1234-1234_0" | |
rxresp | |
txreq -url "/blah/bar?nonsense=42&fooparam" | |
rxresp | |
txreq -url "/blah/xyz?&" | |
rxresp | |
txreq -url "/blah/quux?&2938120-12923_3&utm_source=GatesOfHell&1=2" | |
rxresp | |
txreq -url "/blah/potatoes?tags=Ice+Dispenser&page=42&fooparam=19&fifi" | |
rxresp | |
txreq -url "/how_we_test?&11163888-449553_6&brand=123&n23=12&xxxxxxxxxxxxxxx&page=23" | |
rxresp | |
txreq -url "http://dishwashers.reviewed.com/features/goodbye-granite-the-6-hottest-countertop-finishes?utm_source=taboola&utm_medium=USAT%20Recirc&" | |
rxresp | |
txreq -url "http://refrigerators.reviewed.com/features/seriously-stop-refrigerating-these-foods?utm_source=TB_paid&utm_medium=cpc&" | |
rxresp | |
txreq -url "http://ovens.reviewed.com/news/with-one-chip-ge-creates-diy-smart-appliances?utm_source=usat&utm_medium=referral&utm_campaign=collab&" | |
rxresp | |
txreq -url "/content/lg-65ec9700-4k-oled-tv-first-impressions-review?utm_medium=referral&utm_source=feedblitz&utm_campaign=usatoday-techtopstories" | |
rxresp | |
txreq -url "http://televisions.reviewed.com/features/the-ultimate-movie-player-starts-at-4000?utm_medium=referral&utm_source=dlvr.it.test&dlvrit=384245" | |
rxresp | |
txreq -url "http://laundry.reviewed.com/?utm_source=Adwords&utm_medium=PPC-intoff&gclid=CjwKEAjwkf-gBRCd-b2m2aOo0EQSJABMeQDkU6Wmd-QCSogFgFbcYZzVrk9c99AtrRdj43rZzJ67pRoCtqnw_wcB" | |
rxresp | |
txreq -url "/products/testing?utm_source=Adwords&utm_medium=PPC-intoff&gclid=CjwKEAjwkf-gBRCd-b2m2aOo0EQSJABMeQDkU6Wmd-QCSogFgFbcYZzVrk9c99AtrRdj43rZzJ67pRoCtqnw_wcB&brand=sam" | |
rxresp | |
txreq -url "/features/bone-skulls-and-harmony-check-out-these-french-speakers?amp;utm_medium=referral&utm_campaign=collab" | |
rxresp | |
txreq -url "/features/goodbye-granite?amp;utm_medium" | |
rxresp | |
txreq -url "/seriously-stop-refrigerating-these-foods?utm_source=TB_paid&utm_medium=cpc&" | |
rxresp | |
txreq -url "http://laundry.reviewed.com/types/front-loading?page=1&_escaped_fragment_=" | |
rxresp | |
txreq -url "/ads/interstitial_1?adid=stv_01" | |
rxresp | |
txreq -url "http://www.reviewed.com/" | |
rxresp | |
txreq -url "http://vacuums.reviewed.com//d/reviews/hoover-duros.htm?order_by=msrp%252Cdesc" | |
rxresp | |
txreq -url "/ratings.htm?keywords=Daewoo+Steam+4.5CuFt+Washer%2C+7.3CuFt+GAS+Dryer+1%2C300+Spin+Speed%2C+Smart+Detergent+System&order_by=rating%2Cdesc" | |
rxresp | |
txreq -url "/something.com/articles/12875/attachments.json?tags=Front+Photo%2CHandle+Photo%2CFingerprints+Photo%2CWater%2FIce+Dispenser+Photo%2CControls+Photo%2CWater%2FIce+Dispenser+Controls+Photo%2CInterior+Photo%2CRefrigerator+Main+1+Image%2CRefrigerator+Main+2+Image%2CRefrigerator+Main+3+Image%2CVegetable+Drawer+Photo%2CRefrigerator+Door+1-1+Image%2CIce+Maker+Photo%2CWater+Filter+Photo%2CRefrigerator+Door+2-1+Image%2CFreezer+Main+1+Image%2CFreezer+Door+1+Image%2CSides+Photo%2CBack+Photo&page=1&per_page=6" | |
rxresp | |
txreq -url "/brands/hifiman?brand=hifiman" | |
rxresp | |
} -run | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment