Remove some stray local domains

Remove some stray local domains

sub vcl_recv {
#FASTLY recv

	if (req.request != "HEAD" && req.request != "GET" && req.request != "FASTLYPURGE") {
	  return(pass);
	}

	# Redirect legacy service users to legacy service
	set req.http.X-Referer-Host = regsub(req.http.Referer, "^https?\:\/\/([^\/]+)(\/.*)?$", "\1");
	if (req.url == "/normalize.js" ||
		req.url == "/normalize.css" ||
		req.url == "/normalise.js" ||
		req.url == "/normalise.css" ||
		req.http.X-Referer-Host == "www.manrepeller.com" ||
		req.http.X-Referer-Host == "www.mulesoft.com" ||
		req.http.X-Referer-Host == "iluoghidelcuore.it" ||
		req.http.X-Referer-Host == "it.donga.com" ||
		req.http.X-Referer-Host == "www.watchguard.com" ||
		req.http.X-Referer-Host == "www.mulesoft.org" ||
		req.http.X-Referer-Host == "asmwall.com" ||
		req.http.X-Referer-Host == "www.jcsu.edu" ||
		req.http.X-Referer-Host == "adscendmedia.com" ||
		req.http.X-Referer-Host == "game.donga.com" ||
		req.http.X-Referer-Host == "framkino.no" ||
		req.http.X-Referer-Host == "www.accesswireless.com" ||
		req.http.X-Referer-Host == "represent.com" ||
		req.http.X-Referer-Host == "www.designergreek.com" ||
		req.http.X-Referer-Host == "www.plumbingoverstock.com" ||
		req.http.X-Referer-Host == "servicos.searh.rn.gov.br" ||
		req.http.X-Referer-Host == "www.jane-usa.com" ||
		req.http.X-Referer-Host == "www.juntaempresa.com.br" ||
		req.http.X-Referer-Host == "watchguard.com" ||
		req.http.X-Referer-Host == "www.logianalytics.com" ||
		req.http.X-Referer-Host == "www.thebathpoint.com" ||
		req.http.X-Referer-Host == "blogs.mulesoft.org" ||
		req.http.X-Referer-Host == "www.purecanadiangaming.com" ||
		req.http.X-Referer-Host == "play.egzaminatorius.lt" ||
		req.http.X-Referer-Host == "internetacademi.com" ||
		req.http.X-Referer-Host == "www.skyhighnetworks.com" ||
		req.http.X-Referer-Host == "interactive.guim.co.uk" ||
		req.http.X-Referer-Host == "www.soloio.com" ||
		req.http.X-Referer-Host == "desenvolvimentoparaweb.com" ||
		req.http.X-Referer-Host == "daily-fantasy.trunk.development.manhattan.gq1.yahoo.com" ||
		req.http.X-Referer-Host == "blog.damyller.com.br" ||
		req.http.X-Referer-Host == "doggiebag.no" ||
		req.http.X-Referer-Host == "www.beverlydiamonds.com" ||
		req.http.X-Referer-Host == "www.rogerscup.com" ||
		req.http.X-Referer-Host == "blog.hudy.cz" ||
		req.http.X-Referer-Host == "techhamlet.com" ||
		req.http.X-Referer-Host == "www.flirtfachmann.de" ||
		req.http.X-Referer-Host == "alpacacomics.com" ||
		req.http.X-Referer-Host == "areariservata.fondoprevidenzafinanze.it" ||
		req.http.X-Referer-Host == "www.framkino.no" ||
		req.http.X-Referer-Host == "www.nationalsecurities.com" ||
		req.http.X-Referer-Host == "www.tenniscanada.com" ||
		req.http.X-Referer-Host == "libek.org.rs" ||
		req.http.X-Referer-Host == "learn.logianalytics.com" ||
		req.http.X-Referer-Host == "www.impartner.lt" ||
		req.http.X-Referer-Host == "chameleon.biworldwide.com" ||
		req.http.X-Referer-Host == "www.pujckapowebu.cz" ||
		req.http.X-Referer-Host == "www.dlcnetwork.com" ||
		req.http.X-Referer-Host == "www.forbes.com" ||
		req.http.X-Referer-Host == "blog.skyhighnetworks.com" ||
		req.http.X-Referer-Host == "rflx.bjornborg.com" ||
		req.http.X-Referer-Host == "www.coach-outlet-store.com" ||
		req.http.X-Referer-Host == "gist.io" ||
		req.http.X-Referer-Host == "www.suicideispreventable.org" ||
		req.http.X-Referer-Host == "www.rangemastertacticalgear.com" ||
		req.http.X-Referer-Host == "www.hcpozicka.sk" ||
		req.http.X-Referer-Host == "www.airsoftmegastore.com" ||
		req.http.X-Referer-Host == "colortile.github.io" ||
		req.http.X-Referer-Host == "brasstacksmadras.com" ||
		req.http.X-Referer-Host == "hotelcasadomingo.com.mx" ||
		req.http.X-Referer-Host == "www.worcesterpromotions.co.uk" ||
		req.http.X-Referer-Host == "www.asmwall.com" ||
		req.http.X-Referer-Host == "training.mulesoft.com" ||
		req.http.X-Referer-Host == "exhilarateme.com" ||
		req.http.X-Referer-Host == "www.kommentatorskampen.viasatsport.se" ||
		req.http.X-Referer-Host == "www.golfgearselect.com" ||
		req.http.X-Referer-Host == "www.hcpujcka.cz" ||
		req.http.X-Referer-Host == "www.industriallawsociety.org.uk" ||
		req.http.X-Referer-Host == "www.locawebcorp.com.br" ||
		req.http.X-Referer-Host == "giffffr.giphy.com" ||
		req.http.X-Referer-Host == "mccall.co.uk" ||
		req.http.X-Referer-Host == "kommentatorskampen.viasatsport.se" ||
		req.http.X-Referer-Host == "miraclebodyandpaint.com" ||
		req.http.X-Referer-Host == "www.tymprozdravi.cz" ||
		req.http.X-Referer-Host == "delicius.it" ||
		req.http.X-Referer-Host == "www.bluehighwaygames.com" ||
		req.http.X-Referer-Host == "tales-of-pikohan.de" ||
		req.http.X-Referer-Host == "demo.restoreadytest.com" ||
		req.http.X-Referer-Host == "mark.stratmann.me" ||
		req.http.X-Referer-Host == "apixtechnology.com" ||
		req.http.X-Referer-Host == "www.telefonickapozicka.sk" ||
		req.http.X-Referer-Host == "www.telefonnipujcka.cz" ||
		req.http.X-Referer-Host == "www.iteo.no" ||
		req.http.X-Referer-Host == "www.diktate.info" ||
		req.http.X-Referer-Host == "bpharm.192.168.56.102.xip.io" ||
		req.http.X-Referer-Host == "www.artisanprecast.com" ||
		req.http.X-Referer-Host == "tcisolutions.com" ||
		req.http.X-Referer-Host == "icelebrate.icehotel.com" ||
		req.http.X-Referer-Host == "www.thirtysevenwest.com" ||
		req.http.X-Referer-Host == "www.asgllc.com" ||
		req.http.X-Referer-Host == "www.mailinbox.net" ||
		req.http.X-Referer-Host == "rustyfelty.com" ||
		req.http.X-Referer-Host == "pulse.p2c.com" ||
		req.http.X-Referer-Host == "www.framkino.com" ||
		req.http.X-Referer-Host == "armourselfstorage.com" ||
		req.http.X-Referer-Host == "www.dezrezblog.com" ||
		req.http.X-Referer-Host == "goodpeople.com" ||
		req.http.X-Referer-Host == "www.eden-houlgate.com" ||
		req.http.X-Referer-Host == "www.patiovirtual.com.br" ||
		req.http.X-Referer-Host == "stats.egzaminatorius.lt" ||
		req.http.X-Referer-Host == "www.movieville.org" ||
		req.http.X-Referer-Host == "secure.watchguard.com" ||
		req.http.X-Referer-Host == "nationalsecurities.com" ||
		req.http.X-Referer-Host == "www.snaponindustrial.eu" ||
		req.http.X-Referer-Host == "www.fangear.com" ||
		req.http.X-Referer-Host == "www.scribbleshop.com" ||
		req.http.X-Referer-Host == "forums.mulesoft.org" ||
		req.http.X-Referer-Host == "dataentries.in" ||
		req.http.X-Referer-Host == "maki.alconost.com" ||
		req.http.X-Referer-Host == "dixso.github.io" ||
		req.http.X-Referer-Host == "citaprevia.volkswagen.es" ||
		req.http.X-Referer-Host == "movieville.org" ||
		req.http.X-Referer-Host == "www.seoestudios.com" ||
		req.http.X-Referer-Host == "tickets.campo.nu" ||
		req.http.X-Referer-Host == "perriehale.toucan" ||
		req.http.X-Referer-Host == "online.printstation.cz" ||
		req.http.X-Referer-Host == "www.le-bistrot-basque.com" ||
		req.http.X-Referer-Host == "www.thaiartofmassage.com" ||
		req.http.X-Referer-Host == "www.seevolution.com" ||
		req.http.X-Referer-Host == "janeusa.david" ||
		req.http.X-Referer-Host == "www.goodpeople.com" ||
		req.http.X-Referer-Host == "feeds.feedburner.com" ||
		req.http.X-Referer-Host == "www.millwardesque.com" ||
		req.http.X-Referer-Host == "cci.smartucs.a" ||
		req.http.X-Referer-Host == "forum.tales-of-pikohan.de" ||
		req.http.X-Referer-Host == "small.mu" ||
		req.http.X-Referer-Host == "crisp.toucan" ||
		req.http.X-Referer-Host == "dev1776.nationalsecurities.com" ||
		req.http.X-Referer-Host == "byose.net" ||
		req.http.X-Referer-Host == "www.eurodiary.ie" ||
		req.http.X-Referer-Host == "lemouvementassociatif.org" ||
		req.http.X-Referer-Host == "www.ey.com" ||
		req.http.X-Referer-Host == "cuterunslive.com" ||
		req.http.X-Referer-Host == "blog.odynia.org" ||
		req.http.X-Referer-Host == "solarenaymar.com.ar" ||
		req.http.X-Referer-Host == "www.aispaitalia.it" ||
		req.http.X-Referer-Host == "www.startupsaturday.it" ||
		req.http.X-Referer-Host == "support.watchguard.com" ||
		req.http.X-Referer-Host == "dax.absolnet.se" ||
		req.http.X-Referer-Host == "www.creativeinnovation.net.au" ||
		req.http.X-Referer-Host == "dev.raird.no" ||
		req.http.X-Referer-Host == "lesjeteursdencre.fr" ||
		req.http.X-Referer-Host == "itnotes.pl" ||
		req.http.X-Referer-Host == "www.thesocietyinternational.com" ||
		req.http.X-Referer-Host == "terminalfx.com" ||
		req.http.X-Referer-Host == "draft.sx" ||
		req.http.X-Referer-Host == "atelier-florent.fr" ||
		req.http.X-Referer-Host == "www.buona-tavola-ristorante.fr" ||
		req.http.X-Referer-Host == "www.terminalfx.com" ||
		req.http.X-Referer-Host == "www.taxattorney.com" ||
		req.http.X-Referer-Host == "proenter.dev" ||
		req.http.X-Referer-Host == "bodelo-advocaten.be" ||
		req.http.X-Referer-Host == "www.football1asia.com" ||
		req.http.X-Referer-Host == "rets.ly" ||
		req.http.X-Referer-Host == "erriol.com" ||
		req.http.X-Referer-Host == "shssandiego.com" ||
		req.http.X-Referer-Host == "notecrow.appspot.com" ||
		req.http.X-Referer-Host == "framkino.com" ||
		req.http.X-Referer-Host == "sexsite.daan" ||
		req.http.X-Referer-Host == "sro.dk" ||
		req.http.X-Referer-Host == "www.coloft.com" ||
		req.http.X-Referer-Host == "taxiplus.vsystem.hu" ||
		req.http.X-Referer-Host == "stage.mulesoft.com" ||
		req.http.X-Referer-Host == "local.dev.ugameplan.com" ||
		req.http.X-Referer-Host == "posh-nosh.com" ||
		req.http.X-Referer-Host == "phongthuyshop.vn" ||
		req.http.X-Referer-Host == "local.mansionhouse.co.uk" ||
		req.http.X-Referer-Host == "www.compareaccounting.com" ||
		req.http.X-Referer-Host == "news.coinometrics.com" ||
		req.http.X-Referer-Host == "prod-yann.mailinbox.net" ||
		req.http.X-Referer-Host == "rachelree.se" ||
		req.http.X-Referer-Host == "dev1.accesswireless.usdigitalpartners.net" ||
		req.http.X-Referer-Host == "www.ewirisk.com" ||
		req.http.X-Referer-Host == "snapchan.com" ||
		req.http.X-Referer-Host == "www.trikatasieraakademija.lv" ||
		req.http.X-Referer-Host == "www.fosteringadoptionswindon.org.uk" ||
		req.http.X-Referer-Host == "patiovirtual.com.br" ||
		req.http.X-Referer-Host == "www.libmanpro.com" ||
		req.http.X-Referer-Host == "www.diktate.dev" ||
		req.http.X-Referer-Host == "idisco.pianetaitalia.intra" ||
		req.http.X-Referer-Host == "strudelfolhadinho.com.br" ||
		req.http.X-Referer-Host == "www.cunesoft.com" ||
		req.http.X-Referer-Host == "www.shropshirefoundation.org" ||
		req.http.X-Referer-Host == "speakingofbeauty.tv" ||
		req.http.X-Referer-Host == "www.sbs.com.au" ||
		req.http.X-Referer-Host == "bosch.pikmahosting.de" ||
		req.http.X-Referer-Host == "janeusa.lol" ||
		req.http.X-Referer-Host == "eso.toucan" ||
		req.http.X-Referer-Host == "www.lamedicis.com" ||
		req.http.X-Referer-Host == "cereseurope.com" ||
		req.http.X-Referer-Host == "www.pizza-moltobene.fr" ||
		req.http.X-Referer-Host == "www.kaptiva.com.br" ||
		req.http.X-Referer-Host == "flixified.com" ||
		req.http.X-Referer-Host == "www.12roundsboxing.co.uk" ||
		req.http.X-Referer-Host == "www.tensionautomation.com" ||
		req.http.X-Referer-Host == "www.copyprint.nl" ||
		req.http.X-Referer-Host == "unisol" ||
		req.http.X-Referer-Host == "timepad.ews.co.rs" ||
		req.http.X-Referer-Host == "dev.rets.ly" ||
		req.http.X-Referer-Host == "www.vrhabilis.com" ||
		req.http.X-Referer-Host == "trondheggelund.no" ||
		req.http.X-Referer-Host == "www.ferienwohnungen-lebenswert.de" ||
		req.http.X-Referer-Host == "blog.mainline.com" ||
		req.http.X-Referer-Host == "arcstonepartners.com" ||
		req.http.X-Referer-Host == "dev-mj" ||
		req.http.X-Referer-Host == "www.crisp-cpd.com" ||
		req.http.X-Referer-Host == "purecanadiangaming.com" ||
		req.http.X-Referer-Host == "mainline.com" ||
		req.http.X-Referer-Host == "idx.dev.rets.ly" ||
		req.http.X-Referer-Host == "eneco.flicker.visualwind.com" ||
		req.http.X-Referer-Host == "mi.etoilemedia.it" ||
		req.http.X-Referer-Host == "www.atmosphericwatergenerator.net" ||
		req.http.X-Referer-Host == "www.gasnaturalenergyclass.com" ||
		req.http.X-Referer-Host == "salesmarketing.championpetfoods.com" ||
		req.http.X-Referer-Host == "www.watchgaurd.com" ||
		req.http.X-Referer-Host == "vm-sqlext-svil" ||
		req.http.X-Referer-Host == "dev.accesswireless.usdigitalpartners.net" ||
		req.http.X-Referer-Host == "kommentatorskampen.ohmytest.se" ||
		req.http.X-Referer-Host == "m.euvivoesporte.com.br" ||
		req.http.X-Referer-Host == "blog.dasroot.net" ||
		req.http.X-Referer-Host == "bugsdashboard.com" ||
		req.http.X-Referer-Host == "www.eurodiary.co.uk" ||
		req.http.X-Referer-Host == "seecanadabetter-app.appspot.com" ||
		req.http.X-Referer-Host == "www.bobbychanblog.com" ||
		req.http.X-Referer-Host == "www.mybenefitsatwork.co.uk" ||
		req.http.X-Referer-Host == "www.fotolotos.lt" ||
		req.http.X-Referer-Host == "robferguson.org" ||
		req.http.X-Referer-Host == "staging.motherapp.com" ||
		req.http.X-Referer-Host == "www.undergroundminingequipmentcompaniescalgaryquotes.com" ||
		req.http.X-Referer-Host == "idisco.pianetaitalia.com" ||
		req.http.X-Referer-Host == "cliocalman.com" ||
		req.http.X-Referer-Host == "sexymirror-app.com" ||
		req.http.X-Referer-Host == "taxes-in-serbia.192.168.56.102.xip.io" ||
		req.http.X-Referer-Host == "wunderbiz.com" ||
		req.http.X-Referer-Host == "thebathpoint.webdemo.es" ||
		req.http.X-Referer-Host == "www.restaurant-lemenhir.com" ||
		req.http.X-Referer-Host == "www.valdeure.fr" ||
		req.http.X-Referer-Host == "bpharm.ews.co.rs" ||
		req.http.X-Referer-Host == "teachersdunet.com" ||
		req.http.X-Referer-Host == "livesmartswmo.com" ||
		req.http.X-Referer-Host == "javiblog.com" ||
		req.http.X-Referer-Host == "mi.etoilemedia.com" ||
		req.http.X-Referer-Host == "www.lens.org" ||
		req.http.X-Referer-Host == "blacknet.co.uk" ||
		req.http.X-Referer-Host == "my-faith-be-like.ghost.io" ||
		req.http.X-Referer-Host == "laravel.dev" ||
		req.http.X-Referer-Host == "fi-hpotts.2014-mansionhouse" ||
		req.http.X-Referer-Host == "mi.mailinbox.net" ||
		req.http.X-Referer-Host == "www.schulkeplusrewards.co.uk" ||
		req.http.X-Referer-Host == "sasha-project.s3.amazonaws.com" ||
		req.http.X-Referer-Host == "www.solarenaymar.com.ar" ||
		req.http.X-Referer-Host == "generate.visualwind.com" ||
		req.http.X-Referer-Host == "drupaltest.wgti.net" ||
		req.http.X-Referer-Host == "minasdev.org" ||
		req.http.X-Referer-Host == "ims-logistic.dev" ||
		req.http.X-Referer-Host == "viaresto.com" ||
		req.http.X-Referer-Host == "learn.logixml.com" ||
		req.http.X-Referer-Host == "ox.espadrill-admin" ||
		req.http.X-Referer-Host == "smallmu-sandbox.s3-ap-southeast-1.amazonaws.com" ||
		req.http.X-Referer-Host == "www.firstinternet.co.uk" ||
		req.http.X-Referer-Host == "m.facebook.com" ||
		req.http.X-Referer-Host == "www.ace.media" ||
		req.http.X-Referer-Host == "www.ewiretx.com" ||
		req.http.X-Referer-Host == "crisp.test.tdev.co.uk" ||
		req.http.X-Referer-Host == "www.mifabricavisual.com" ||
		req.http.X-Referer-Host == "www.targetintervention.no" ||
		req.http.X-Referer-Host == "www.couperogers.com" ||
		req.http.X-Referer-Host == "skyhighstaging.local.com" ||
		req.http.X-Referer-Host == "altorendimientoacademico.queretaro.itesm.mx" ||
		req.http.X-Referer-Host == "www.gall-holl.com" ||
		req.http.X-Referer-Host == "sbs-moad.s3-ap-southeast-2.amazonaws.com" ||
		req.http.X-Referer-Host == "firstint.recruitment-lite" ||
		req.http.X-Referer-Host == "www.sro.dk" ||
		req.http.X-Referer-Host == "www.menbur.com" ||
		req.http.X-Referer-Host == "libmanpro.com" ||
		req.http.X-Referer-Host == "blurayaustralia.com" ||
		req.http.X-Referer-Host == "www.adscendmedia.com" ||
		req.http.X-Referer-Host == "blog.vincentbrouillet.com" ||
		req.http.X-Referer-Host == "www.investiumonline.nl" ||
		req.http.X-Referer-Host == "burakkp.com" ||
		req.http.X-Referer-Host == "audreysystem.seeties.me" ||
		req.http.X-Referer-Host == "everestsalesconsultants.co.uk" ||
		req.http.X-Referer-Host == "accesswireless.usdphosting.com" ||
		req.http.X-Referer-Host == "frota.searh.rn.gov.br" ||
		req.http.X-Referer-Host == "qa.ugameplan.com" ||
		req.http.X-Referer-Host == "secure.yec.co" ||
		req.http.X-Referer-Host == "connect.eu.mulesoft.com" ||
		req.http.X-Referer-Host == "www.lastlongerreview.com" ||
		req.http.X-Referer-Host == "kommentatorskampen.lo" ||
		req.http.X-Referer-Host == "kido.bigroominternet.co.uk" ||
		req.http.X-Referer-Host == "ohmydev.se" ||
		req.http.X-Referer-Host == "www.bentogarcia.es" ||
		req.http.X-Referer-Host == "rearview.herokai.com" ||
		req.http.X-Referer-Host == "lecafelatin.resto-ready.com" ||
		req.http.X-Referer-Host == "html24-dev.dk" ||
		req.http.X-Referer-Host == "seecanadabetter.ddev" ||
		req.http.X-Referer-Host == "portal.ad1.wrvc.co.uk" ||
		req.http.X-Referer-Host == "garthwunsch.com" ||
		req.http.X-Referer-Host == "www.elitecustomsigns.com" ||
		req.http.X-Referer-Host == "kaptiva.com.br" ||
		req.http.X-Referer-Host == "nordicinox.com" ||
		req.http.X-Referer-Host == "www.nataktivisterna.lo" ||
		req.http.X-Referer-Host == "www.fidalgobaycoffee.com" ||
		req.http.X-Referer-Host == "mailinbox.net" ||
		req.http.X-Referer-Host == "www.tension.com" ||
		req.http.X-Referer-Host == "www.mccall.co.uk" ||
		req.http.X-Referer-Host == "petbucks.org" ||
		req.http.X-Referer-Host == "mulesoftcompdev.prod.acquia-sites.com" ||
		req.http.X-Referer-Host == "logidev.devcloud.acquia-sites.com" ||
		req.http.X-Referer-Host == "www.cuterunslive.com" ||
		req.http.X-Referer-Host == "ec2-54-86-27-137.compute-1.amazonaws.com" ||
		req.http.X-Referer-Host == "coloft.com" ||
		req.http.X-Referer-Host == "dev-yann.mailinbox.net" ||
		req.http.X-Referer-Host == "titistore.es" ||
		req.http.X-Referer-Host == "biztro.pl" ||
		req.http.X-Referer-Host == "zd.ews.co.rs" ||
		req.http.X-Referer-Host == "www.cafelatincaen.com" ||
		req.http.X-Referer-Host == "togume.com" ||
		req.http.X-Referer-Host == "connect.mulesoft.com" ||
		req.http.X-Referer-Host == "nataktivisterna.lo" ||
		req.http.X-Referer-Host == "livelean.co.uk" ||
		req.http.X-Referer-Host == "copyprint.nl" ||
		req.http.X-Referer-Host == "jayhathaway.com" ||
		req.http.X-Referer-Host == "rugsejis.epratybos.lt" ||
		req.http.X-Referer-Host == "media-env.elasticbeanstalk.com" ||
		req.http.X-Referer-Host == "id.snowfire.io" ||
		req.http.X-Referer-Host == "employme.at" ||
		req.http.X-Referer-Host == "booleanbrothers.com" ||
		req.http.X-Referer-Host == "www.fusiongroup.ie" ||
		req.http.X-Referer-Host == "skyhighnetworks.gravitatestaging.com" ||
		req.http.X-Referer-Host == "www.teachers.youtalkonline.com" ||
		req.http.X-Referer-Host == "sunshineandfrank.com" ||
		req.http.X-Referer-Host == "proof.acemedia.bigroominternet.co.uk" ||
		req.http.X-Referer-Host == "personaltrainersinlosangeles.com" ||
		req.http.X-Referer-Host == "www.shawn.co" ||
		req.http.X-Referer-Host == "solidproperty.com.my" ||
		req.http.X-Referer-Host == "www.nordicinox.com" ||
		req.http.X-Referer-Host == "tension.com" ||
		req.http.X-Referer-Host == "especiaiss3.gshow.globo.com" ||
		req.http.X-Referer-Host == "seebstore.com" ||
		req.http.X-Referer-Host == "packerz.uk" ||
		req.http.X-Referer-Host == "happyliving.jp" ||
		req.http.X-Referer-Host == "www.vacacionesdebuenrollito.com" ||
		req.http.X-Referer-Host == "plastpack.ind.br" ||
		req.http.X-Referer-Host == "finance.trunk.development.manhattan.gq1.yahoo.com" ||
		req.http.X-Referer-Host == "elearningpprd.biworldwide.com" ||
		req.http.X-Referer-Host == "millwardesque.com" ||
		req.http.X-Referer-Host == "icehotel.lo" ||
		req.http.X-Referer-Host == "ongair.im" ||
		req.http.X-Referer-Host == "mule01a.managed.contegix.com" ||
		req.http.X-Referer-Host == "ipated.org" ||
		req.http.X-Referer-Host == "cientifica-research.com" ||
		req.http.X-Referer-Host == "andreypopp.github.io" ||
		req.http.X-Referer-Host == "schools.medsense.in" ||
		req.http.X-Referer-Host == "d-ycl.cigna.com" ||
		req.http.X-Referer-Host == "romankorver.com" ||
		req.http.X-Referer-Host == "ihaveanidea.me" ||
		req.http.X-Referer-Host == "evoyan.org" ||
		req.http.X-Referer-Host == "cectserver.dyndns.org" ||
		req.http.X-Referer-Host == "test.idx.dev.rets.ly" ||
		req.http.X-Referer-Host == "vastgoedpro.dataquote.nl" ||
		req.http.X-Referer-Host == "sifopweb" ||
		req.http.X-Referer-Host == "instituteofselfmastery.com.au" ||
		req.http.X-Referer-Host == "www.automobrella.com" ||
		req.http.X-Referer-Host == "panel.mibubu.com" ||
		req.http.X-Referer-Host == "whsb.herokuapp.com" ||
		req.http.X-Referer-Host == "heastea.com" ||
		req.http.X-Referer-Host == "meishinkan.pl" ||
		req.http.X-Referer-Host == "manrepeller.staging.wpengine.com" ||
		req.http.X-Referer-Host == "derprecated.com" ||
		req.http.X-Referer-Host == "fobesfamily.com" ||
		req.http.X-Referer-Host == "tensionautomation.com" ||
		req.http.X-Referer-Host == "www.jesuisoriginale.com" ||
		req.http.X-Referer-Host == "www.domgonsa.com.ar" ||
		req.http.X-Referer-Host == "www.digitalpark.co.uk" ||
		req.http.X-Referer-Host == "debray.jerome.free.fr" ||
		req.http.X-Referer-Host == "rainmakerthinking.training" ||
		req.http.X-Referer-Host == "thespineauthority.com.au" ||
		req.http.X-Referer-Host == "pseudocubic.com" ||
		req.http.X-Referer-Host == "mi.sky8.it" ||
		req.http.X-Referer-Host == "iteo.staging.wpengine.com" ||
		req.http.X-Referer-Host == "adscend-q.dev" ||
		req.http.X-Referer-Host == "taxes-in-serbia.ews.co.rs" ||
		req.http.X-Referer-Host == "s.codepen.io" ||
		req.http.X-Referer-Host == "seecanadabetter.ca" ||
		req.http.X-Referer-Host == "www.werkbund.com.br" ||
		req.http.X-Referer-Host == "www.art365.co.za" ||
		req.http.X-Referer-Host == "tensionpackaging.com" ||
		req.http.X-Referer-Host == "ec2-54-164-179-111.compute-1.amazonaws.com" ||
		req.http.X-Referer-Host == "sms.loc" ||
		req.http.X-Referer-Host == "timeclock.neonandmore.com" ||
		req.http.X-Referer-Host == "silverblingblack.com" ||
		req.http.X-Referer-Host == "www.modulolanguage.com" ||
		req.http.X-Referer-Host == "visualise.today" ||
		req.http.X-Referer-Host == "pickinglist.constance.com.br" ||
		req.http.X-Referer-Host == "mobileshoppingapps.net" ||
		req.http.X-Referer-Host == "ashleyandbarry.com" ||
		req.http.X-Referer-Host == "www.planetgreen.cl" ||
		req.http.X-Referer-Host == "portal-intranet.ti.sabesp.com.br" ||
		req.http.X-Referer-Host == "gordonrecords.net" ||
		req.http.X-Referer-Host == "cce.pathlore.net" ||
		req.http.X-Referer-Host == "www.myclaimvalue.com" ||
		req.http.X-Referer-Host == "stage.mulesoft.org" ||
		req.http.X-Referer-Host == "javiblog.javigs.es"
	) {
		set req.http.X-Redir-URL = "https://legacy.polyfill.io" req.url;
		error 900 req.http.X-Redir-URL;
	}

	if (req.url ~ "^/v1/polyfill\." && req.url !~ "[\?\&]ua=") {
		set req.http.X-Orig-URL = req.url;
		set req.url = "/v1/normalizeUa?ua=" regsuball(regsuball(regsuball(req.http.User-Agent, {"%"}, {"%25"}), {" "}, {"%20"}), {"&"}, {"%26"});
	}

	return(lookup);
}

sub vcl_deliver {
#FASTLY deliver
	if (req.url ~ "^/v1/normalizeUa" && resp.status == 200) {
		set req.http.Fastly-force-Shield = "1";
		if (req.http.X-Orig-URL ~ "\?") {
			set req.url = req.http.X-Orig-URL "&ua=" resp.http.Normalized-User-Agent;
		} else {
			set req.url = req.http.X-Orig-URL "?ua=" resp.http.Normalized-User-Agent;
		}
		restart;
	} else if (req.url ~ "^/v1/polyfill\..*[\?\&]ua=" && req.http.X-Orig-URL && req.http.X-Orig-URL !~ "[\?\&]ua=") {
		set resp.http.Vary = "Accept-Encoding, User-Agent";
	}
	return(deliver);
}

sub vcl_error {
	if (obj.status == 900) {
		set obj.http.Location = obj.response;
		set obj.status = 301;
		set obj.response = "Moved Permanently";
		synthetic {"The referer header or request URI supplied in your request is known to be an attempt to use the previous version of polyfill.io, so for backwards compatibility we're redirecting you to legacy.polyfill.io which will handle your request using the old version of the service.  The legacy version will be discontinued in the future, so please update to the new version, and then let us know by raising an issue in our repo at https://github.com/financial-times/polyfill-service."};
		return (deliver);
	}
}

sub vcl_recv {
#FASTLY recv

	if (req.request != "HEAD" && req.request != "GET" && req.request != "FASTLYPURGE") {
	  return(pass);
	}

	# Redirect legacy service users to legacy service
	set req.http.X-Referer-Host = regsub(req.http.Referer, "^https?\:\/\/([^\/]+)(\/.*)?$", "\1");
	if (req.url == "/normalize.js" ||
		req.url == "/normalize.css" ||
		req.url == "/normalise.js" ||
		req.url == "/normalise.css" ||
		req.http.X-Referer-Host == "www.manrepeller.com" ||
		req.http.X-Referer-Host == "www.mulesoft.com" ||
		req.http.X-Referer-Host == "iluoghidelcuore.it" ||
		req.http.X-Referer-Host == "it.donga.com" ||
		req.http.X-Referer-Host == "www.watchguard.com" ||
		req.http.X-Referer-Host == "www.mulesoft.org" ||
		req.http.X-Referer-Host == "asmwall.com" ||
		req.http.X-Referer-Host == "www.jcsu.edu" ||
		req.http.X-Referer-Host == "adscendmedia.com" ||
		req.http.X-Referer-Host == "game.donga.com" ||
		req.http.X-Referer-Host == "framkino.no" ||
		req.http.X-Referer-Host == "www.accesswireless.com" ||
		req.http.X-Referer-Host == "represent.com" ||
		req.http.X-Referer-Host == "www.designergreek.com" ||
		req.http.X-Referer-Host == "www.plumbingoverstock.com" ||
		req.http.X-Referer-Host == "servicos.searh.rn.gov.br" ||
		req.http.X-Referer-Host == "www.jane-usa.com" ||
		req.http.X-Referer-Host == "www.juntaempresa.com.br" ||
		req.http.X-Referer-Host == "watchguard.com" ||
		req.http.X-Referer-Host == "www.logianalytics.com" ||
		req.http.X-Referer-Host == "www.thebathpoint.com" ||
		req.http.X-Referer-Host == "blogs.mulesoft.org" ||
		req.http.X-Referer-Host == "www.purecanadiangaming.com" ||
		req.http.X-Referer-Host == "play.egzaminatorius.lt" ||
		req.http.X-Referer-Host == "internetacademi.com" ||
		req.http.X-Referer-Host == "www.skyhighnetworks.com" ||
		req.http.X-Referer-Host == "interactive.guim.co.uk" ||
		req.http.X-Referer-Host == "www.soloio.com" ||
		req.http.X-Referer-Host == "desenvolvimentoparaweb.com" ||
		req.http.X-Referer-Host == "daily-fantasy.trunk.development.manhattan.gq1.yahoo.com" ||
		req.http.X-Referer-Host == "blog.damyller.com.br" ||
		req.http.X-Referer-Host == "doggiebag.no" ||
		req.http.X-Referer-Host == "www.beverlydiamonds.com" ||
		req.http.X-Referer-Host == "www.rogerscup.com" ||
		req.http.X-Referer-Host == "blog.hudy.cz" ||
		req.http.X-Referer-Host == "techhamlet.com" ||
		req.http.X-Referer-Host == "www.flirtfachmann.de" ||
		req.http.X-Referer-Host == "alpacacomics.com" ||
		req.http.X-Referer-Host == "areariservata.fondoprevidenzafinanze.it" ||
		req.http.X-Referer-Host == "www.framkino.no" ||
		req.http.X-Referer-Host == "www.nationalsecurities.com" ||
		req.http.X-Referer-Host == "www.tenniscanada.com" ||
		req.http.X-Referer-Host == "libek.org.rs" ||
		req.http.X-Referer-Host == "learn.logianalytics.com" ||
		req.http.X-Referer-Host == "www.impartner.lt" ||
		req.http.X-Referer-Host == "chameleon.biworldwide.com" ||
		req.http.X-Referer-Host == "www.pujckapowebu.cz" ||
		req.http.X-Referer-Host == "www.dlcnetwork.com" ||
		req.http.X-Referer-Host == "www.forbes.com" ||
		req.http.X-Referer-Host == "blog.skyhighnetworks.com" ||
		req.http.X-Referer-Host == "rflx.bjornborg.com" ||
		req.http.X-Referer-Host == "www.coach-outlet-store.com" ||
		req.http.X-Referer-Host == "gist.io" ||
		req.http.X-Referer-Host == "www.suicideispreventable.org" ||
		req.http.X-Referer-Host == "www.rangemastertacticalgear.com" ||
		req.http.X-Referer-Host == "www.hcpozicka.sk" ||
		req.http.X-Referer-Host == "www.airsoftmegastore.com" ||
		req.http.X-Referer-Host == "colortile.github.io" ||
		req.http.X-Referer-Host == "brasstacksmadras.com" ||
		req.http.X-Referer-Host == "hotelcasadomingo.com.mx" ||
		req.http.X-Referer-Host == "client.local" ||
		req.http.X-Referer-Host == "www.worcesterpromotions.co.uk" ||
		req.http.X-Referer-Host == "www.asmwall.com" ||
		req.http.X-Referer-Host == "training.mulesoft.com" ||
		req.http.X-Referer-Host == "exhilarateme.com" ||
		req.http.X-Referer-Host == "www.kommentatorskampen.viasatsport.se" ||
		req.http.X-Referer-Host == "www.golfgearselect.com" ||
		req.http.X-Referer-Host == "www.hcpujcka.cz" ||
		req.http.X-Referer-Host == "www.industriallawsociety.org.uk" ||
		req.http.X-Referer-Host == "www.locawebcorp.com.br" ||
		req.http.X-Referer-Host == "giffffr.giphy.com" ||
		req.http.X-Referer-Host == "mccall.co.uk" ||
		req.http.X-Referer-Host == "kommentatorskampen.viasatsport.se" ||
		req.http.X-Referer-Host == "miraclebodyandpaint.com" ||
		req.http.X-Referer-Host == "www.tymprozdravi.cz" ||
		req.http.X-Referer-Host == "delicius.it" ||
		req.http.X-Referer-Host == "www.bluehighwaygames.com" ||
		req.http.X-Referer-Host == "tales-of-pikohan.de" ||
		req.http.X-Referer-Host == "demo.restoreadytest.com" ||
		req.http.X-Referer-Host == "mark.stratmann.me" ||
		req.http.X-Referer-Host == "apixtechnology.com" ||
		req.http.X-Referer-Host == "www.telefonickapozicka.sk" ||
		req.http.X-Referer-Host == "www.telefonnipujcka.cz" ||
		req.http.X-Referer-Host == "www.iteo.no" ||
		req.http.X-Referer-Host == "www.diktate.info" ||
		req.http.X-Referer-Host == "bpharm.192.168.56.102.xip.io" ||
		req.http.X-Referer-Host == "www.artisanprecast.com" ||
		req.http.X-Referer-Host == "tcisolutions.com" ||
		req.http.X-Referer-Host == "icelebrate.icehotel.com" ||
		req.http.X-Referer-Host == "www.thirtysevenwest.com" ||
		req.http.X-Referer-Host == "www.asgllc.com" ||
		req.http.X-Referer-Host == "www.mailinbox.net" ||
		req.http.X-Referer-Host == "rustyfelty.com" ||
		req.http.X-Referer-Host == "pulse.p2c.com" ||
		req.http.X-Referer-Host == "www.framkino.com" ||
		req.http.X-Referer-Host == "armourselfstorage.com" ||
		req.http.X-Referer-Host == "www.dezrezblog.com" ||
		req.http.X-Referer-Host == "goodpeople.com" ||
		req.http.X-Referer-Host == "www.eden-houlgate.com" ||
		req.http.X-Referer-Host == "www.patiovirtual.com.br" ||
		req.http.X-Referer-Host == "stats.egzaminatorius.lt" ||
		req.http.X-Referer-Host == "www.movieville.org" ||
		req.http.X-Referer-Host == "secure.watchguard.com" ||
		req.http.X-Referer-Host == "nationalsecurities.com" ||
		req.http.X-Referer-Host == "www.snaponindustrial.eu" ||
		req.http.X-Referer-Host == "www.fangear.com" ||
		req.http.X-Referer-Host == "www.scribbleshop.com" ||
		req.http.X-Referer-Host == "forums.mulesoft.org" ||
		req.http.X-Referer-Host == "dataentries.in" ||
		req.http.X-Referer-Host == "maki.alconost.com" ||
		req.http.X-Referer-Host == "dixso.github.io" ||
		req.http.X-Referer-Host == "citaprevia.volkswagen.es" ||
		req.http.X-Referer-Host == "movieville.org" ||
		req.http.X-Referer-Host == "www.seoestudios.com" ||
		req.http.X-Referer-Host == "tickets.campo.nu" ||
		req.http.X-Referer-Host == "perriehale.toucan" ||
		req.http.X-Referer-Host == "online.printstation.cz" ||
		req.http.X-Referer-Host == "www.le-bistrot-basque.com" ||
		req.http.X-Referer-Host == "www.thaiartofmassage.com" ||
		req.http.X-Referer-Host == "www.seevolution.com" ||
		req.http.X-Referer-Host == "janeusa.david" ||
		req.http.X-Referer-Host == "www.goodpeople.com" ||
		req.http.X-Referer-Host == "feeds.feedburner.com" ||
		req.http.X-Referer-Host == "www.millwardesque.com" ||
		req.http.X-Referer-Host == "cci.smartucs.a" ||
		req.http.X-Referer-Host == "forum.tales-of-pikohan.de" ||
		req.http.X-Referer-Host == "small.mu" ||
		req.http.X-Referer-Host == "crisp.toucan" ||
		req.http.X-Referer-Host == "www.fosterdenovo.local" ||
		req.http.X-Referer-Host == "dev1776.nationalsecurities.com" ||
		req.http.X-Referer-Host == "byose.net" ||
		req.http.X-Referer-Host == "www.eurodiary.ie" ||
		req.http.X-Referer-Host == "lemouvementassociatif.org" ||
		req.http.X-Referer-Host == "www.ey.com" ||
		req.http.X-Referer-Host == "cuterunslive.com" ||
		req.http.X-Referer-Host == "blog.odynia.org" ||
		req.http.X-Referer-Host == "solarenaymar.com.ar" ||
		req.http.X-Referer-Host == "www.aispaitalia.it" ||
		req.http.X-Referer-Host == "www.startupsaturday.it" ||
		req.http.X-Referer-Host == "support.watchguard.com" ||
		req.http.X-Referer-Host == "dax.absolnet.se" ||
		req.http.X-Referer-Host == "www.creativeinnovation.net.au" ||
		req.http.X-Referer-Host == "dev.raird.no" ||
		req.http.X-Referer-Host == "lesjeteursdencre.fr" ||
		req.http.X-Referer-Host == "itnotes.pl" ||
		req.http.X-Referer-Host == "www.thesocietyinternational.com" ||
		req.http.X-Referer-Host == "terminalfx.com" ||
		req.http.X-Referer-Host == "draft.sx" ||
		req.http.X-Referer-Host == "atelier-florent.fr" ||
		req.http.X-Referer-Host == "www.buona-tavola-ristorante.fr" ||
		req.http.X-Referer-Host == "www.terminalfx.com" ||
		req.http.X-Referer-Host == "www.taxattorney.com" ||
		req.http.X-Referer-Host == "proenter.dev" ||
		req.http.X-Referer-Host == "bodelo-advocaten.be" ||
		req.http.X-Referer-Host == "www.football1asia.com" ||
		req.http.X-Referer-Host == "rets.ly" ||
		req.http.X-Referer-Host == "erriol.com" ||
		req.http.X-Referer-Host == "shssandiego.com" ||
		req.http.X-Referer-Host == "notecrow.appspot.com" ||
		req.http.X-Referer-Host == "framkino.com" ||
		req.http.X-Referer-Host == "sexsite.daan" ||
		req.http.X-Referer-Host == "sro.dk" ||
		req.http.X-Referer-Host == "www.coloft.com" ||
		req.http.X-Referer-Host == "taxiplus.vsystem.hu" ||
		req.http.X-Referer-Host == "stage.mulesoft.com" ||
		req.http.X-Referer-Host == "local.dev.ugameplan.com" ||
		req.http.X-Referer-Host == "posh-nosh.com" ||
		req.http.X-Referer-Host == "phongthuyshop.vn" ||
		req.http.X-Referer-Host == "local.mansionhouse.co.uk" ||
		req.http.X-Referer-Host == "www.compareaccounting.com" ||
		req.http.X-Referer-Host == "news.coinometrics.com" ||
		req.http.X-Referer-Host == "prod-yann.mailinbox.net" ||
		req.http.X-Referer-Host == "rachelree.se" ||
		req.http.X-Referer-Host == "dev1.accesswireless.usdigitalpartners.net" ||
		req.http.X-Referer-Host == "www.ewirisk.com" ||
		req.http.X-Referer-Host == "snapchan.com" ||
		req.http.X-Referer-Host == "www.trikatasieraakademija.lv" ||
		req.http.X-Referer-Host == "www.fosteringadoptionswindon.org.uk" ||
		req.http.X-Referer-Host == "patiovirtual.com.br" ||
		req.http.X-Referer-Host == "www.libmanpro.com" ||
		req.http.X-Referer-Host == "www.diktate.dev" ||
		req.http.X-Referer-Host == "idisco.pianetaitalia.intra" ||
		req.http.X-Referer-Host == "strudelfolhadinho.com.br" ||
		req.http.X-Referer-Host == "www.cunesoft.com" ||
		req.http.X-Referer-Host == "www.shropshirefoundation.org" ||
		req.http.X-Referer-Host == "speakingofbeauty.tv" ||
		req.http.X-Referer-Host == "www.sbs.com.au" ||
		req.http.X-Referer-Host == "bosch.pikmahosting.de" ||
		req.http.X-Referer-Host == "janeusa.lol" ||
		req.http.X-Referer-Host == "eso.toucan" ||
		req.http.X-Referer-Host == "www.lamedicis.com" ||
		req.http.X-Referer-Host == "cereseurope.com" ||
		req.http.X-Referer-Host == "www.pizza-moltobene.fr" ||
		req.http.X-Referer-Host == "www.kaptiva.com.br" ||
		req.http.X-Referer-Host == "flixified.com" ||
		req.http.X-Referer-Host == "www.12roundsboxing.co.uk" ||
		req.http.X-Referer-Host == "www.tensionautomation.com" ||
		req.http.X-Referer-Host == "www.copyprint.nl" ||
		req.http.X-Referer-Host == "unisol" ||
		req.http.X-Referer-Host == "timepad.ews.co.rs" ||
		req.http.X-Referer-Host == "dev.rets.ly" ||
		req.http.X-Referer-Host == "www.vrhabilis.com" ||
		req.http.X-Referer-Host == "trondheggelund.no" ||
		req.http.X-Referer-Host == "www.ferienwohnungen-lebenswert.de" ||
		req.http.X-Referer-Host == "blog.mainline.com" ||
		req.http.X-Referer-Host == "arcstonepartners.com" ||
		req.http.X-Referer-Host == "dev-mj" ||
		req.http.X-Referer-Host == "www.crisp-cpd.com" ||
		req.http.X-Referer-Host == "purecanadiangaming.com" ||
		req.http.X-Referer-Host == "mainline.com" ||
		req.http.X-Referer-Host == "idx.dev.rets.ly" ||
		req.http.X-Referer-Host == "eneco.flicker.visualwind.com" ||
		req.http.X-Referer-Host == "mi.etoilemedia.it" ||
		req.http.X-Referer-Host == "www.atmosphericwatergenerator.net" ||
		req.http.X-Referer-Host == "www.gasnaturalenergyclass.com" ||
		req.http.X-Referer-Host == "salesmarketing.championpetfoods.com" ||
		req.http.X-Referer-Host == "www.watchgaurd.com" ||
		req.http.X-Referer-Host == "vm-sqlext-svil" ||
		req.http.X-Referer-Host == "dev.accesswireless.usdigitalpartners.net" ||
		req.http.X-Referer-Host == "kommentatorskampen.ohmytest.se" ||
		req.http.X-Referer-Host == "m.euvivoesporte.com.br" ||
		req.http.X-Referer-Host == "blog.dasroot.net" ||
		req.http.X-Referer-Host == "bugsdashboard.com" ||
		req.http.X-Referer-Host == "www.eurodiary.co.uk" ||
		req.http.X-Referer-Host == "seecanadabetter-app.appspot.com" ||
		req.http.X-Referer-Host == "www.bobbychanblog.com" ||
		req.http.X-Referer-Host == "www.mybenefitsatwork.co.uk" ||
		req.http.X-Referer-Host == "www.fotolotos.lt" ||
		req.http.X-Referer-Host == "robferguson.org" ||
		req.http.X-Referer-Host == "staging.motherapp.com" ||
		req.http.X-Referer-Host == "www.undergroundminingequipmentcompaniescalgaryquotes.com" ||
		req.http.X-Referer-Host == "idisco.pianetaitalia.com" ||
		req.http.X-Referer-Host == "cliocalman.com" ||
		req.http.X-Referer-Host == "sexymirror-app.com" ||
		req.http.X-Referer-Host == "taxes-in-serbia.192.168.56.102.xip.io" ||
		req.http.X-Referer-Host == "wunderbiz.com" ||
		req.http.X-Referer-Host == "thebathpoint.webdemo.es" ||
		req.http.X-Referer-Host == "www.restaurant-lemenhir.com" ||
		req.http.X-Referer-Host == "www.valdeure.fr" ||
		req.http.X-Referer-Host == "bpharm.ews.co.rs" ||
		req.http.X-Referer-Host == "teachersdunet.com" ||
		req.http.X-Referer-Host == "livesmartswmo.com" ||
		req.http.X-Referer-Host == "javiblog.com" ||
		req.http.X-Referer-Host == "portal.com.local" ||
		req.http.X-Referer-Host == "mi.etoilemedia.com" ||
		req.http.X-Referer-Host == "www.lens.org" ||
		req.http.X-Referer-Host == "blacknet.co.uk" ||
		req.http.X-Referer-Host == "my-faith-be-like.ghost.io" ||
		req.http.X-Referer-Host == "laravel.dev" ||
		req.http.X-Referer-Host == "fi-hpotts.2014-mansionhouse" ||
		req.http.X-Referer-Host == "mi.mailinbox.net" ||
		req.http.X-Referer-Host == "www.schulkeplusrewards.co.uk" ||
		req.http.X-Referer-Host == "sasha-project.s3.amazonaws.com" ||
		req.http.X-Referer-Host == "www.solarenaymar.com.ar" ||
		req.http.X-Referer-Host == "generate.visualwind.com" ||
		req.http.X-Referer-Host == "drupaltest.wgti.net" ||
		req.http.X-Referer-Host == "minasdev.org" ||
		req.http.X-Referer-Host == "ims-logistic.dev" ||
		req.http.X-Referer-Host == "viaresto.com" ||
		req.http.X-Referer-Host == "learn.logixml.com" ||
		req.http.X-Referer-Host == "ox.espadrill-admin" ||
		req.http.X-Referer-Host == "smallmu-sandbox.s3-ap-southeast-1.amazonaws.com" ||
		req.http.X-Referer-Host == "www.firstinternet.co.uk" ||
		req.http.X-Referer-Host == "m.facebook.com" ||
		req.http.X-Referer-Host == "www.ace.media" ||
		req.http.X-Referer-Host == "www.ewiretx.com" ||
		req.http.X-Referer-Host == "crisp.test.tdev.co.uk" ||
		req.http.X-Referer-Host == "www.mifabricavisual.com" ||
		req.http.X-Referer-Host == "www.targetintervention.no" ||
		req.http.X-Referer-Host == "www.couperogers.com" ||
		req.http.X-Referer-Host == "skyhighstaging.local.com" ||
		req.http.X-Referer-Host == "altorendimientoacademico.queretaro.itesm.mx" ||
		req.http.X-Referer-Host == "www.gall-holl.com" ||
		req.http.X-Referer-Host == "sbs-moad.s3-ap-southeast-2.amazonaws.com" ||
		req.http.X-Referer-Host == "firstint.recruitment-lite" ||
		req.http.X-Referer-Host == "www.sro.dk" ||
		req.http.X-Referer-Host == "www.menbur.com" ||
		req.http.X-Referer-Host == "libmanpro.com" ||
		req.http.X-Referer-Host == "blurayaustralia.com" ||
		req.http.X-Referer-Host == "www.adscendmedia.com" ||
		req.http.X-Referer-Host == "blog.vincentbrouillet.com" ||
		req.http.X-Referer-Host == "www.investiumonline.nl" ||
		req.http.X-Referer-Host == "burakkp.com" ||
		req.http.X-Referer-Host == "audreysystem.seeties.me" ||
		req.http.X-Referer-Host == "everestsalesconsultants.co.uk" ||
		req.http.X-Referer-Host == "accesswireless.usdphosting.com" ||
		req.http.X-Referer-Host == "frota.searh.rn.gov.br" ||
		req.http.X-Referer-Host == "qa.ugameplan.com" ||
		req.http.X-Referer-Host == "secure.yec.co" ||
		req.http.X-Referer-Host == "connect.eu.mulesoft.com" ||
		req.http.X-Referer-Host == "www.lastlongerreview.com" ||
		req.http.X-Referer-Host == "kommentatorskampen.lo" ||
		req.http.X-Referer-Host == "kido.bigroominternet.co.uk" ||
		req.http.X-Referer-Host == "ohmydev.se" ||
		req.http.X-Referer-Host == "www.bentogarcia.es" ||
		req.http.X-Referer-Host == "rearview.herokai.com" ||
		req.http.X-Referer-Host == "lecafelatin.resto-ready.com" ||
		req.http.X-Referer-Host == "html24-dev.dk" ||
		req.http.X-Referer-Host == "seecanadabetter.ddev" ||
		req.http.X-Referer-Host == "portal.ad1.wrvc.co.uk" ||
		req.http.X-Referer-Host == "garthwunsch.com" ||
		req.http.X-Referer-Host == "www.elitecustomsigns.com" ||
		req.http.X-Referer-Host == "kaptiva.com.br" ||
		req.http.X-Referer-Host == "nordicinox.com" ||
		req.http.X-Referer-Host == "www.nataktivisterna.lo" ||
		req.http.X-Referer-Host == "www.fidalgobaycoffee.com" ||
		req.http.X-Referer-Host == "mailinbox.net" ||
		req.http.X-Referer-Host == "www.tension.com" ||
		req.http.X-Referer-Host == "www.mccall.co.uk" ||
		req.http.X-Referer-Host == "petbucks.org" ||
		req.http.X-Referer-Host == "mulesoftcompdev.prod.acquia-sites.com" ||
		req.http.X-Referer-Host == "logidev.devcloud.acquia-sites.com" ||
		req.http.X-Referer-Host == "www.cuterunslive.com" ||
		req.http.X-Referer-Host == "ec2-54-86-27-137.compute-1.amazonaws.com" ||
		req.http.X-Referer-Host == "coloft.com" ||
		req.http.X-Referer-Host == "dev-yann.mailinbox.net" ||
		req.http.X-Referer-Host == "titistore.es" ||
		req.http.X-Referer-Host == "biztro.pl" ||
		req.http.X-Referer-Host == "zd.ews.co.rs" ||
		req.http.X-Referer-Host == "www.cafelatincaen.com" ||
		req.http.X-Referer-Host == "togume.com" ||
		req.http.X-Referer-Host == "connect.mulesoft.com" ||
		req.http.X-Referer-Host == "che.local" ||
		req.http.X-Referer-Host == "nataktivisterna.lo" ||
		req.http.X-Referer-Host == "livelean.co.uk" ||
		req.http.X-Referer-Host == "copyprint.nl" ||
		req.http.X-Referer-Host == "jayhathaway.com" ||
		req.http.X-Referer-Host == "rugsejis.epratybos.lt" ||
		req.http.X-Referer-Host == "media-env.elasticbeanstalk.com" ||
		req.http.X-Referer-Host == "id.snowfire.io" ||
		req.http.X-Referer-Host == "employme.at" ||
		req.http.X-Referer-Host == "booleanbrothers.com" ||
		req.http.X-Referer-Host == "www.fusiongroup.ie" ||
		req.http.X-Referer-Host == "skyhighnetworks.gravitatestaging.com" ||
		req.http.X-Referer-Host == "www.teachers.youtalkonline.com" ||
		req.http.X-Referer-Host == "sunshineandfrank.com" ||
		req.http.X-Referer-Host == "proof.acemedia.bigroominternet.co.uk" ||
		req.http.X-Referer-Host == "personaltrainersinlosangeles.com" ||
		req.http.X-Referer-Host == "www.shawn.co" ||
		req.http.X-Referer-Host == "solidproperty.com.my" ||
		req.http.X-Referer-Host == "www.nordicinox.com" ||
		req.http.X-Referer-Host == "tension.com" ||
		req.http.X-Referer-Host == "especiaiss3.gshow.globo.com" ||
		req.http.X-Referer-Host == "seebstore.com" ||
		req.http.X-Referer-Host == "packerz.uk" ||
		req.http.X-Referer-Host == "happyliving.jp" ||
		req.http.X-Referer-Host == "www.vacacionesdebuenrollito.com" ||
		req.http.X-Referer-Host == "plastpack.ind.br" ||
		req.http.X-Referer-Host == "finance.trunk.development.manhattan.gq1.yahoo.com" ||
		req.http.X-Referer-Host == "elearningpprd.biworldwide.com" ||
		req.http.X-Referer-Host == "millwardesque.com" ||
		req.http.X-Referer-Host == "icehotel.lo" ||
		req.http.X-Referer-Host == "ongair.im" ||
		req.http.X-Referer-Host == "mule01a.managed.contegix.com" ||
		req.http.X-Referer-Host == "ipated.org" ||
		req.http.X-Referer-Host == "cientifica-research.com" ||
		req.http.X-Referer-Host == "andreypopp.github.io" ||
		req.http.X-Referer-Host == "schools.medsense.in" ||
		req.http.X-Referer-Host == "d-ycl.cigna.com" ||
		req.http.X-Referer-Host == "romankorver.com" ||
		req.http.X-Referer-Host == "ihaveanidea.me" ||
		req.http.X-Referer-Host == "evoyan.org" ||
		req.http.X-Referer-Host == "cectserver.dyndns.org" ||
		req.http.X-Referer-Host == "test.idx.dev.rets.ly" ||
		req.http.X-Referer-Host == "vastgoedpro.dataquote.nl" ||
		req.http.X-Referer-Host == "sifopweb" ||
		req.http.X-Referer-Host == "instituteofselfmastery.com.au" ||
		req.http.X-Referer-Host == "www.automobrella.com" ||
		req.http.X-Referer-Host == "panel.mibubu.com" ||
		req.http.X-Referer-Host == "whsb.herokuapp.com" ||
		req.http.X-Referer-Host == "heastea.com" ||
		req.http.X-Referer-Host == "meishinkan.pl" ||
		req.http.X-Referer-Host == "manrepeller.staging.wpengine.com" ||
		req.http.X-Referer-Host == "derprecated.com" ||
		req.http.X-Referer-Host == "fobesfamily.com" ||
		req.http.X-Referer-Host == "tensionautomation.com" ||
		req.http.X-Referer-Host == "www.jesuisoriginale.com" ||
		req.http.X-Referer-Host == "www.domgonsa.com.ar" ||
		req.http.X-Referer-Host == "www.digitalpark.co.uk" ||
		req.http.X-Referer-Host == "debray.jerome.free.fr" ||
		req.http.X-Referer-Host == "rainmakerthinking.training" ||
		req.http.X-Referer-Host == "thespineauthority.com.au" ||
		req.http.X-Referer-Host == "pseudocubic.com" ||
		req.http.X-Referer-Host == "mi.sky8.it" ||
		req.http.X-Referer-Host == "iteo.staging.wpengine.com" ||
		req.http.X-Referer-Host == "adscend-q.dev" ||
		req.http.X-Referer-Host == "taxes-in-serbia.ews.co.rs" ||
		req.http.X-Referer-Host == "s.codepen.io" ||
		req.http.X-Referer-Host == "seecanadabetter.ca" ||
		req.http.X-Referer-Host == "www.werkbund.com.br" ||
		req.http.X-Referer-Host == "www.art365.co.za" ||
		req.http.X-Referer-Host == "tensionpackaging.com" ||
		req.http.X-Referer-Host == "ec2-54-164-179-111.compute-1.amazonaws.com" ||
		req.http.X-Referer-Host == "sms.loc" ||
		req.http.X-Referer-Host == "timeclock.neonandmore.com" ||
		req.http.X-Referer-Host == "silverblingblack.com" ||
		req.http.X-Referer-Host == "www.modulolanguage.com" ||
		req.http.X-Referer-Host == "visualise.today" ||
		req.http.X-Referer-Host == "pickinglist.constance.com.br" ||
		req.http.X-Referer-Host == "mobileshoppingapps.net" ||
		req.http.X-Referer-Host == "ashleyandbarry.com" ||
		req.http.X-Referer-Host == "www.planetgreen.cl" ||
		req.http.X-Referer-Host == "portal-intranet.ti.sabesp.com.br" ||
		req.http.X-Referer-Host == "gordonrecords.net" ||
		req.http.X-Referer-Host == "cce.pathlore.net" ||
		req.http.X-Referer-Host == "www.myclaimvalue.com" ||
		req.http.X-Referer-Host == "stage.mulesoft.org" ||
		req.http.X-Referer-Host == "javiblog.javigs.es"
	) {
		set req.http.X-Redir-URL = "https://legacy.polyfill.io" req.url;
		error 900 req.http.X-Redir-URL;
	}

	if (req.url ~ "^/v1/polyfill\." && req.url !~ "[\?\&]ua=") {
		set req.http.X-Orig-URL = req.url;
		set req.url = "/v1/normalizeUa?ua=" regsuball(regsuball(regsuball(req.http.User-Agent, {"%"}, {"%25"}), {" "}, {"%20"}), {"&"}, {"%26"});
	}

	return(lookup);
}

sub vcl_deliver {
#FASTLY deliver
	if (req.url ~ "^/v1/normalizeUa" && resp.status == 200) {
		set req.http.Fastly-force-Shield = "1";
		if (req.http.X-Orig-URL ~ "\?") {
			set req.url = req.http.X-Orig-URL "&ua=" resp.http.Normalized-User-Agent;
		} else {
			set req.url = req.http.X-Orig-URL "?ua=" resp.http.Normalized-User-Agent;
		}
		restart;
	} else if (req.url ~ "^/v1/polyfill\..*[\?\&]ua=" && req.http.X-Orig-URL && req.http.X-Orig-URL !~ "[\?\&]ua=") {
		set resp.http.Vary = "Accept-Encoding, User-Agent";
	}
	return(deliver);
}

sub vcl_error {
	if (obj.status == 900) {
		set obj.http.Location = obj.response;
		set obj.status = 301;
		set obj.response = "Moved Permanently";
		synthetic {"The referer header or request URI supplied in your request is known to be an attempt to use the previous version of polyfill.io, so for backwards compatibility we're redirecting you to legacy.polyfill.io which will handle your request using the old version of the service.  The legacy version will be discontinued in the future, so please update to the new version, and then let us know by raising an issue in our repo at https://github.com/financial-times/polyfill-service."};
		return (deliver);
	}
}


messing with web sockets

messing with web sockets

# This is a basic VCL configuration file for varnish.  See the vcl(7)
# man page for details on VCL syntax and semantics.

import std;

# static
backend default {
  .host = "127.0.0.1";
  .port = "4000";
}
backend examples {
  .host = "127.0.0.1";
  .port = "8080";
}
backend components {
  .host = "127.0.0.1";
  .port = "3330";
}

sub vcl_recv {
  if (!req.http.Host) {
    error 404 "Need a host header";
  }

  set req.http.Host = regsub(req.http.Host, "^www\.", "");
  set req.http.Host = regsub(req.http.Host, ":80$", "");

  if (
    req.http.Host ~ "^chat\." ||
    req.http.Host ~ "^charts\." ||
    req.http.Host ~ "^directory\." ||
    req.http.Host ~ "^codemirror\." ||
    req.http.Host ~ "^hello\." ||
    req.http.Host ~ "^sink\." ||
    req.http.Host ~ "^todos\." ||
    req.http.Host ~ "^widgets\."
  ) {
    set req.backend = examples;
  } else if (req.http.Host ~ "^components\.") {
    set req.backend = components;
  }

  if (req.http.Upgrade ~ "(?i)websocket") {
    return (pipe);
  }

  if (req.restarts == 0) {
    if (req.http.x-forwarded-for) {
      set req.http.X-Forwarded-For =
        req.http.X-Forwarded-For + ", " + client.ip;
    } else {
      set req.http.X-Forwarded-For = client.ip;
    }
  }
  if (req.request != "GET" &&
      req.request != "HEAD" &&
      req.request != "PUT" &&
      req.request != "POST" &&
      req.request != "TRACE" &&
      req.request != "OPTIONS" &&
      req.request != "DELETE") {
    /* Non-RFC2616 or CONNECT which is weird. */
    return (pipe);
  }
  if (req.request != "GET" && req.request != "HEAD") {
    /* We only deal with GET and HEAD by default */
    return (pass);
  }
  if (req.http.Authorization || req.http.Cookie) {
    /* Not cacheable by default */
    return (pass);
  }
  return (lookup);
}

sub vcl_pipe {
  # Websockets
  if (req.http.upgrade) {
    set bereq.http.upgrade = req.http.upgrade;
  }
}

# This is a basic VCL configuration file for varnish.  See the vcl(7)
# man page for details on VCL syntax and semantics.

import std;

# static
backend default {
  .host = "127.0.0.1";
  .port = "4000";
}
backend examples {
  .host = "127.0.0.1";
  .port = "8080";
}
backend components {
  .host = "127.0.0.1";
  .port = "3330";
}

sub vcl_recv {
  if (!req.http.Host) {
    error 404 "Need a host header";
  }

  set req.http.Host = regsub(req.http.Host, "^www\.", "");
  set req.http.Host = regsub(req.http.Host, ":80$", "");

  if (req.restarts == 0) {
    if (req.http.x-forwarded-for) {
      set req.http.X-Forwarded-For =
        req.http.X-Forwarded-For + ", " + client.ip;
    } else {
      set req.http.X-Forwarded-For = client.ip;
    }
  }

  if (
    req.http.Host ~ "^chat\." ||
    req.http.Host ~ "^charts\." ||
    req.http.Host ~ "^directory\." ||
    req.http.Host ~ "^codemirror\." ||
    req.http.Host ~ "^hello\." ||
    req.http.Host ~ "^sink\." ||
    req.http.Host ~ "^todos\." ||
    req.http.Host ~ "^widgets\."
  ) {
    set req.backend = examples;
  } else if (req.http.Host ~ "^components\.") {
    set req.backend = components;
  }

  if (req.request != "GET" &&
      req.request != "HEAD" &&
      req.request != "PUT" &&
      req.request != "POST" &&
      req.request != "TRACE" &&
      req.request != "OPTIONS" &&
      req.request != "DELETE") {
    /* Non-RFC2616 or CONNECT which is weird. */
    return (pipe);
  }
  if (req.http.Upgrade ~ "(?i)websocket") {
    return (pipe);
  }
  if (req.request != "GET" && req.request != "HEAD") {
    /* We only deal with GET and HEAD by default */
    return (pass);
  }
  if (req.http.Authorization || req.http.Cookie) {
    /* Not cacheable by default */
    return (pass);
  }
  return (lookup);
}

sub vcl_hash {
  hash_data(req.url);
  if (req.http.host) {
    hash_data(req.http.host);
  } else {
    hash_data(server.ip);
  }
  if (req.http.Origin) {
    hash_data(req.http.Origin);
  }
  return (hash);
}

sub vcl_pipe {
  # Websockets
  if (req.http.upgrade) {
    set bereq.http.upgrade = req.http.upgrade;
  }
}

sub vcl_fetch {
  # Compress responses
  if (beresp.http.content-type ~ "text"
      || beresp.http.content-type ~ "json"
      || beresp.http.content-type ~ "javascript") {
    set beresp.do_gzip = true;
  }
}

sub vcl_error {
  if (obj.status == 750) {
    # moved permanently
    set obj.http.Location = req.http.Location;
    set obj.status = 301;
  } else if (obj.status == 752) {
    # moved temporarily
    set obj.http.Location = req.http.Location;
    set obj.status = 302;
  } else {
    set obj.http.Content-Type = "text/html; charset=utf-8";
    set obj.http.Retry-After = "5";
    synthetic std.fileread("/etc/varnish/503.html");
  }
  return (deliver);
}


Move Cache-Control/Pragma setting to vcl_deliver and extend grace to a day

###############################################################################
#
# Fastly CDN for Magento 2
#
# NOTICE OF LICENSE
#
# This source file is subject to the Fastly CDN for Magento 2 End User License
# Agreement that is bundled with this package in the file LICENSE_FASTLY_CDN.txt.
#
# @copyright   Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
# @license     BSD, see LICENSE_FASTLY_CDN.txt
#
###############################################################################

# This is a basic VCL configuration file for Fastly CDN for Magento 2 module.

sub vcl_recv {
#FASTLY recv

    # Fixup for Varnish ESI not dealing with https:// absolute URLs well
    if (req.is_esi_subreq && req.url ~ "/https://([^/]+)(/.*)$") {
        set req.http.Host = re.group.1;
        set req.url = re.group.2;
    }

    if (req.url ~ "^/static/version(\d*/)?(.*)$") {
       set req.url = "/static/" + re.group.2 + "?" + re.group.1;
    }

    # auth for purging
    if (req.request == "FASTLYPURGE") {
        # extract token signature and expiration
        set req.http.X-Sig = regsub(req.http.X-Purge-Token, "^[^_]+_(.*)", "\1");
        set req.http.X-Exp = regsub(req.http.X-Purge-Token, "^([^_]+)_.*", "\1");

        # validate signature
        if (req.http.X-Sig == regsub(digest.hmac_sha1(req.service_id, req.url.path req.http.X-Exp), "^0x", "")) {

            # use vcl time math to check expiration timestamp
            set req.http.X-Original-Grace = req.grace;
            set req.grace = std.atoi(strftime({"%s"}, now));
            set req.grace -= std.atoi(req.http.X-Exp);

            if (std.atoi(req.grace) > 0) {
                error 410;
            }

            # clean up grace since we used it for time math
            set req.grace = std.atoi(req.http.X-Original-Grace);
            unset req.http.X-Original-Grace;

        } else {
            error 403;
        }

        # cleanup variables
        unset req.http.X-Purge-Token;
        unset req.http.X-Sig;
        unset req.http.X-Exp;
    }

    # set HTTPS header for offloaded TLS
    if (req.http.Fastly-SSL) {
        set req.http.Https = "on";
    }

    # disable ESI processing on Origin Shield
    if (req.http.Fastly-FF) {
        set req.esi = false;
    }

    # We only deal with GET and HEAD by default
    if (req.request != "GET" && req.request != "HEAD") {
        return (pass);
    }

    # geoip lookup
    if (req.url ~ "fastlyCdn/geoip/getaction/") {
        # check if GeoIP has been already processed by client. this normally happens before essential cookies are set.
        if (req.http.cookie ~ "(X-Magento-Vary|form_key)=") {
            error 200 "";
        } else {
            # append parameter with country code only if it doesn't exist already
            if ( req.url !~ "country_code=" ) {
                set req.url = req.url "?country_code=" if ( req.http.geo_override, req.http.geo_override, geoip.country_code);
            }
        }
    } else {
        # Per suggestions in https://github.com/sdinteractive/SomethingDigital_PageCacheParams
        # we'll strip out query parameters used in Google AdWords, Mailchimp tracking
        set req.http.Fastly-Original-URL = req.url;
        set req.url = querystring.regfilter(req.url, "^(utm_.*|gclid|gdftrk|_ga|mc_.*)");
    }

    # static files are always cacheable. remove SSL flag and cookie
    if (req.url ~ "^/(pub/)?(media|static)/.*") {
        unset req.http.Https;
        unset req.http.Cookie;
        return (lookup);
    }

    # Bypass shopping cart and checkout requests
    if (req.url ~ "/checkout") {
        return (pass);
    }

    return(lookup);
}

sub vcl_fetch {

    # Remove Set-Cookies from responses for static content
    # to match the cookie removal in recv.
    if (req.url ~ "^/(pub/)?(media|static)/") {
        unset beresp.http.set-cookie;

        # Set a short TTL for 404's
        if (beresp.status == 404) {
            set beresp.ttl = 300s;
        }

    }

#FASTLY fetch

    if (beresp.status >= 500) {
        # let SOAP errors pass - better debugging
        if (beresp.http.Content-Type ~ "text/xml") {
            return (deliver);
        }

        if (req.restarts < 1 && (req.request == "GET" || req.request == "HEAD")) {
            restart;
        }
    }

    if (req.restarts > 0 ) {
        set beresp.http.Fastly-Restarts = req.restarts;
    }

    if (beresp.http.Content-Type ~ "text/html" || beresp.http.Content-Type ~ "text/xml") {
        # enable ESI feature for Magento response by default
        esi;
        # Since varnish doesn't compress ESIs we need to hint to the HTTP/2 terminators to
        # compress it
        set beresp.http.x-compress-hint = "on";
    } else {
        # enable gzip for all static content
        if ((beresp.status == 200 || beresp.status == 404) && (beresp.http.content-type ~ "^(application\/x\-javascript|text\/css|application\/javascript|text\/javascript|application\/json|application\/vnd\.ms\-fontobject|application\/x\-font\-opentype|application\/x\-font\-truetype|application\/x\-font\-ttf|application\/xml|font\/eot|font\/opentype|font\/otf|image\/svg\+xml|image\/vnd\.microsoft\.icon|text\/plain)\s*($|;)" || req.url ~ "\.(css|js|html|eot|ico|otf|ttf|json)($|\?)" ) ) {
            # always set vary to make sure uncompressed versions dont always win
            if (!beresp.http.Vary ~ "Accept-Encoding") {
                if (beresp.http.Vary) {
                    set beresp.http.Vary = beresp.http.Vary ", Accept-Encoding";
                } else {
                    set beresp.http.Vary = "Accept-Encoding";
                }
            }
            if (req.http.Accept-Encoding == "gzip") {
                set beresp.gzip = true;
            }
        }
    }

    # cache only successfully responses and 404s
    if (beresp.status != 200 && beresp.status != 301 && beresp.status != 404) {
        set req.http.Fastly-Cachetype = "ERROR";
        set beresp.ttl = 1s;
        set beresp.grace = 5s;
        return (deliver);
    } elsif (beresp.http.Cache-Control ~ "private") {
        set req.http.Fastly-Cachetype = "PRIVATE";
        return (pass);
    }

    if (beresp.http.X-Magento-Debug) {
        set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control;
    }

    # validate if we need to cache it and prevent from setting cookie
    # images, css and js are cacheable by default so we have to remove cookie also
    if (beresp.ttl > 0s && (req.request == "GET" || req.request == "HEAD")) {
        unset beresp.http.set-cookie;
        if (req.url !~ "^/(pub/)?(media|static)/.*") {
            set beresp.grace = 86400m;
        }

        # init surrogate keys
        if (beresp.http.X-Magento-Tags) {
            set beresp.http.Surrogate-Key = beresp.http.X-Magento-Tags " text";
        } else {
            set beresp.http.Surrogate-Key = "text";
        }

        # set surrogate keys by content type
        if (beresp.http.Content-Type ~ "image") {
            set beresp.http.Surrogate-Key = "image";
        } elsif (beresp.http.Content-Type ~ "script") {
            set beresp.http.Surrogate-Key = "script";
        } elsif (beresp.http.Content-Type ~ "css") {
            set beresp.http.Surrogate-Key = "css";
        }

        set beresp.http.X-Surrogate-Key = beresp.http.Surrogate-Key;
        return (deliver);
    }

    return (deliver);
}

sub vcl_hit {
#FASTLY hit

    if (!obj.cacheable) {
        return(pass);
    }
    return(deliver);
}

sub vcl_miss {
    # Deactivate gzip on origin
    unset bereq.http.Accept-Encoding;

#FASTLY miss

    return(fetch);
}

sub vcl_deliver {

    # Send no cache headers to end users for non-static content. Also make sure
    # we only set this on the edge nodes and not on shields
    if (req.url !~ "^/(pub/)?(media|static)/.*" && !req.http.Fastly-FF ) {
        set resp.http.Pragma = "no-cache";
        set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
    }

    # Add an easy way to see whether custom Fastly VCL has been uploaded
    if ( req.http.Fastly-Debug ) {
        set resp.http.Fastly-Magento-VCL-Uploaded = "yes";
    } else {
        remove resp.http.Fastly-Module-Enabled;
    }
    # debug info
    if (resp.http.X-Magento-Debug) {
        if (obj.hits > 0) {
            set resp.http.X-Magento-Cache-Debug = "HIT";
            set resp.http.X-Magento-Cache-Hits = obj.hits;
        } else {
            set resp.http.X-Magento-Cache-Debug = "MISS";
        }
    } else {
        # remove Varnish/proxy header
        remove resp.http.Age;
        remove resp.http.X-Magento-Debug;
        remove resp.http.X-Magento-Tags;
        remove resp.http.X-Surrogate-Key;
        remove resp.http.X-Magento-Cache-Control;
        remove resp.http.X-Powered-By;
        remove resp.http.Server;
        remove resp.http.X-Varnish;
        remove resp.http.Via;
        remove resp.http.Link;
        remove resp.http.X-Purge-URL;
        remove resp.http.X-Purge-Host;
    }

#FASTLY deliver

    return (deliver);
}

sub vcl_error {
    # workaround for possible security issue
    if (req.url ~ "^\s") {
        set obj.status = 400;
        set obj.response = "Malformed request";
        synthetic "";
        return (deliver);
    }

    # error 200
    if (obj.status == 200) {
        return (deliver);
    }

     set obj.http.Content-Type = "text/html; charset=utf-8";
     set obj.http.Retry-After = "5";
     synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

        <title>"} obj.status " " obj.response {"</title>

Error "} obj.status " " obj.response {"

"} obj.response {"

Guru Meditation:

XID: "} req.xid {"

Fastly CDN server

"};

#FASTLY error
}

sub vcl_pass {
#FASTLY pass
}

sub vcl_hash {
    set req.hash += req.http.Https;
    set req.hash += req.http.host;
    set req.hash += req.url;

    if (req.http.cookie:X-Magento-Vary ) {
        set req.hash += req.http.cookie:X-Magento-Vary;
    }

    set req.hash += "#####GENERATION#####";

    ### {{ design_exceptions_code }} ###

    return (hash);
}

###############################################################################
#
# Fastly CDN for Magento 2
#
# NOTICE OF LICENSE
#
# This source file is subject to the Fastly CDN for Magento 2 End User License
# Agreement that is bundled with this package in the file LICENSE_FASTLY_CDN.txt.
#
# @copyright   Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
# @license     BSD, see LICENSE_FASTLY_CDN.txt
#
###############################################################################

# This is a basic VCL configuration file for Fastly CDN for Magento 2 module.
import querystring;

sub vcl_recv {
#FASTLY recv

    # Fixup for Varnish ESI not dealing with https:// absolute URLs well
    if (req.is_esi_subreq && req.url ~ "/https://([^/]+)(/.*)$") {
        set req.http.Host = re.group.1;
        set req.url = re.group.2;
    }

    if (req.url ~ "^/static/version(\d*/)?(.*)$") {
       set req.url = "/static/" + re.group.2 + "?" + re.group.1;
    }

    # auth for purging
    if (req.request == "FASTLYPURGE") {
        # extract token signature and expiration
        set req.http.X-Sig = regsub(req.http.X-Purge-Token, "^[^_]+_(.*)", "\1");
        set req.http.X-Exp = regsub(req.http.X-Purge-Token, "^([^_]+)_.*", "\1");

        # validate signature
        if (req.http.X-Sig == regsub(digest.hmac_sha1(req.service_id, req.url.path req.http.X-Exp), "^0x", "")) {

            # use vcl time math to check expiration timestamp
            set req.http.X-Original-Grace = req.grace;
            set req.grace = std.atoi(strftime({"%s"}, now));
            set req.grace -= std.atoi(req.http.X-Exp);

            if (std.atoi(req.grace) > 0) {
                error 410;
            }

            # clean up grace since we used it for time math
            set req.grace = std.atoi(req.http.X-Original-Grace);
            unset req.http.X-Original-Grace;

        } else {
            error 403;
        }

        # cleanup variables
        unset req.http.X-Purge-Token;
        unset req.http.X-Sig;
        unset req.http.X-Exp;
    }

    # set HTTPS header for offloaded TLS
    if (req.http.Fastly-SSL) {
        set req.http.Https = "on";
    }

    # disable ESI processing on Origin Shield
    if (req.http.Fastly-FF) {
        set req.esi = false;
    }

    # We only deal with GET and HEAD by default
    if (req.request != "GET" && req.request != "HEAD") {
        return (pass);
    }

    # geoip lookup
    if (req.url ~ "fastlyCdn/geoip/getaction/") {
        # check if GeoIP has been already processed by client. this normally happens before essential cookies are set.
        if (req.http.cookie ~ "(X-Magento-Vary|form_key)=") {
            error 200 "";
        } else {
            # append parameter with country code only if it doesn't exist already
            if ( req.url !~ "country_code=" ) {
                set req.url = req.url "?country_code=" if ( req.http.geo_override, req.http.geo_override, geoip.country_code);
            }
        }
    } else {
        # Per suggestions in https://github.com/sdinteractive/SomethingDigital_PageCacheParams
        # we'll strip out query parameters used in Google AdWords, Mailchimp tracking
        set req.http.Fastly-Original-URL = req.url;
        set req.url = querystring.regfilter(req.url, "^(utm_.*|gclid|gdftrk|_ga|mc_.*)");
    }

    # static files are always cacheable. remove SSL flag and cookie
    if (req.url ~ "^/(pub/)?(media|static)/.*") {
        unset req.http.Https;
        unset req.http.Cookie;
        return (lookup);
    }

    # Bypass shopping cart and checkout requests
    if (req.url ~ "/checkout") {
        return (pass);
    }

    return(lookup);
}

sub vcl_fetch {

    # Remove Set-Cookies from responses for static content
    # to match the cookie removal in recv.
    if (req.url ~ "^/(pub/)?(media|static)/") {
        unset beresp.http.set-cookie;

        # Set a short TTL for 404's
        if (beresp.status == 404) {
            set beresp.ttl = 300s;
        }

    }

#FASTLY fetch

    if (beresp.status >= 500) {
        # let SOAP errors pass - better debugging
        if (beresp.http.Content-Type ~ "text/xml") {
            return (deliver);
        }

        if (req.restarts < 1 && (req.request == "GET" || req.request == "HEAD")) {
            restart;
        }
    }

    if (req.restarts > 0 ) {
        set beresp.http.Fastly-Restarts = req.restarts;
    }

    if (beresp.http.Content-Type ~ "text/html" || beresp.http.Content-Type ~ "text/xml") {
        # enable ESI feature for Magento response by default
        esi;
        # Since varnish doesn't compress ESIs we need to hint to the HTTP/2 terminators to
        # compress it
        set beresp.http.x-compress-hint = "on";
    } else {
        # enable gzip for all static content
        if ((beresp.status == 200 || beresp.status == 404) && (beresp.http.content-type ~ "^(application\/x\-javascript|text\/css|application\/javascript|text\/javascript|application\/json|application\/vnd\.ms\-fontobject|application\/x\-font\-opentype|application\/x\-font\-truetype|application\/x\-font\-ttf|application\/xml|font\/eot|font\/opentype|font\/otf|image\/svg\+xml|image\/vnd\.microsoft\.icon|text\/plain)\s*($|;)" || req.url ~ "\.(css|js|html|eot|ico|otf|ttf|json)($|\?)" ) ) {
            # always set vary to make sure uncompressed versions dont always win
            if (!beresp.http.Vary ~ "Accept-Encoding") {
                if (beresp.http.Vary) {
                    set beresp.http.Vary = beresp.http.Vary ", Accept-Encoding";
                } else {
                    set beresp.http.Vary = "Accept-Encoding";
                }
            }
            if (req.http.Accept-Encoding == "gzip") {
                set beresp.gzip = true;
            }
        }
    }

    # cache only successfully responses and 404s
    if (beresp.status != 200 && beresp.status != 301 && beresp.status != 404) {
        set req.http.Fastly-Cachetype = "ERROR";
        set beresp.ttl = 1s;
        set beresp.grace = 5s;
        return (deliver);
    } elsif (beresp.http.Cache-Control ~ "private") {
        set req.http.Fastly-Cachetype = "PRIVATE";
        return (pass);
    }

    if (beresp.http.X-Magento-Debug) {
        set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control;
    }

    # validate if we need to cache it and prevent from setting cookie
    # images, css and js are cacheable by default so we have to remove cookie also
    if (beresp.ttl > 0s && (req.request == "GET" || req.request == "HEAD")) {
        unset beresp.http.set-cookie;
        if (req.url !~ "^/(pub/)?(media|static)/.*") {
            set beresp.http.Pragma = "no-cache";
            set beresp.http.Expires = "-1";
            set beresp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
            set beresp.grace = 1m;
        }

        # init surrogate keys
        if (beresp.http.X-Magento-Tags) {
            set beresp.http.Surrogate-Key = beresp.http.X-Magento-Tags " text";
        } else {
            set beresp.http.Surrogate-Key = "text";
        }

        # set surrogate keys by content type
        if (beresp.http.Content-Type ~ "image") {
            set beresp.http.Surrogate-Key = "image";
        } elsif (beresp.http.Content-Type ~ "script") {
            set beresp.http.Surrogate-Key = "script";
        } elsif (beresp.http.Content-Type ~ "css") {
            set beresp.http.Surrogate-Key = "css";
        }

        set beresp.http.X-Surrogate-Key = beresp.http.Surrogate-Key;
        return (deliver);
    }

    return (deliver);
}

sub vcl_hit {
#FASTLY hit

    if (!obj.cacheable) {
        return(pass);
    }
    return(deliver);
}

sub vcl_miss {
    # Deactivate gzip on origin
    unset bereq.http.Accept-Encoding;

#FASTLY miss

    return(fetch);
}

sub vcl_deliver {

    # Add an easy way to see whether custom Fastly VCL has been uploaded
    if ( req.http.Fastly-Debug ) {
        set resp.http.Fastly-Magento-VCL-Uploaded = "yes";
    } else {
        remove resp.http.Fastly-Module-Enabled;
    }
    # debug info
    if (resp.http.X-Magento-Debug) {
        if (obj.hits > 0) {
            set resp.http.X-Magento-Cache-Debug = "HIT";
            set resp.http.X-Magento-Cache-Hits = obj.hits;
        } else {
            set resp.http.X-Magento-Cache-Debug = "MISS";
        }
    } else {
        # remove Varnish/proxy header
        remove resp.http.Age;
        remove resp.http.X-Magento-Debug;
        remove resp.http.X-Magento-Tags;
        remove resp.http.X-Surrogate-Key;
        remove resp.http.X-Magento-Cache-Control;
        remove resp.http.X-Powered-By;
        remove resp.http.Server;
        remove resp.http.X-Varnish;
        remove resp.http.Via;
        remove resp.http.Link;
        remove resp.http.X-Purge-URL;
        remove resp.http.X-Purge-Host;
    }

#FASTLY deliver

    return (deliver);
}

sub vcl_error {
    # workaround for possible security issue
    if (req.url ~ "^\s") {
        set obj.status = 400;
        set obj.response = "Malformed request";
        synthetic "";
        return (deliver);
    }

    # error 200
    if (obj.status == 200) {
        return (deliver);
    }

     set obj.http.Content-Type = "text/html; charset=utf-8";
     set obj.http.Retry-After = "5";
     synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

        <title>"} obj.status " " obj.response {"</title>

Error "} obj.status " " obj.response {"

"} obj.response {"

Guru Meditation:

XID: "} req.xid {"

Fastly CDN server

"};

#FASTLY error
}

sub vcl_pass {
#FASTLY pass
}

sub vcl_hash {
    set req.hash += req.http.Https;
    set req.hash += req.http.host;
    set req.hash += req.url;

    if (req.http.cookie:X-Magento-Vary ) {
        set req.hash += req.http.cookie:X-Magento-Vary;
    }

    set req.hash += "#####GENERATION#####";

    ### {{ design_exceptions_code }} ###

    return (hash);
}


fix varnish with multiple hosts

fix varnish with multiple hosts

vcl 4.0;

# Disable esi xml check on varnish Startup
# Example:
#   DAEMON_OPTS="-a :6081 \
#     -T localhost:6082 \
#     -p feature=+esi_disable_xml_check
#     -p feature=+esi_ignore_https
#

backend default {
        .host = "127.0.0.1";
        .port = "8085";
}

sub vcl_recv {
        if (req.method != "GET") {
                return (pass);
        }
        if (req.http.Cookie ~ "\bvarnish-force=pass") {
                return (pass);
        }

        return (hash);
}

sub vcl_hash {
        hash_data(req.host);
        hash_data(req.url);
        return(lookup);
}

sub vcl_backend_response {
        if (beresp.http.Cache-Control != "public") {
                set beresp.uncacheable = true;
                set beresp.ttl = 3m;
                return (deliver);
        }

        set beresp.do_esi = true;
        set beresp.ttl = 15m;

        unset beresp.http.Set-Cookie;
}

vcl 4.0;

# Disable esi xml check on varnish Startup
# Example:
#   DAEMON_OPTS="-a :6081 \
#     -T localhost:6082 \
#     -p feature=+esi_disable_xml_check
#     -p feature=+esi_ignore_https
#

backend dev {
        .host = "127.0.0.1";
        .port = "8085";
}
backend beta {
        .host = "127.0.0.1";
        .port = "8086";
}

sub vcl_recv {
		if (req.http.host == "dev.khanovaskola.cz") {
			set req.backend = dev;
		}
		if (req.http.host == "beta.khanovaskola.cz") {
            set req.backend = beta;
        }

        if (req.method != "GET") {
                return (pass);
        }
        if (req.http.Cookie ~ "\bvarnish-force=pass") {
                return (pass);
        }

        return (hash);
}

sub vcl_hash {
        hash_data(req.url);
        return(lookup);
}

sub vcl_backend_response {
        if (beresp.http.Cache-Control != "public") {
                set beresp.uncacheable = true;
                set beresp.ttl = 3m;
                return (deliver);
        }

        set beresp.do_esi = true;
        set beresp.ttl = 15m;

        unset beresp.http.Set-Cookie;
}


varnish comment

varnish comment

import dclass;
#import urlcode;

backend default {
	.host = "localhost";
	.port = "80";
}

sub vcl_init {
	# load openddr
	dclass.init_dclass("/some/path/dClass/dtrees/openddr.dtree");
	#dclass.init_dclass_p("/some/path/OpenDDR/1.0.0.0/resources",0);

	# load browser dtree
	dclass.init_dclass_p("/some/path/dClass/dtrees/browser.dtree",1);
}

sub vcl_recv {
	# ua override
	if(req.url ~ "[^\w]ua="){
		set req.http.user-agent = regsub(req.url,"^.*[^\w]ua=([^&]*).*","\1");
		#set req.http.user-agent = urlcode.decode(regsub(req.url,"^.*[^\w]ua=([^&]*).*","\1"));
	}

	# do the lookup
	set req.http.dclass_openddr = dclass.classify(req.http.user-agent);
	#set req.http.dclass_openddr = dclass.classify_p(req.http.user-agent,0);
	set req.http.dclass_browser = dclass.classify_p(req.http.user-agent,1);

	# set dclass_type
	set req.http.dclass_type = "unknown";
	if(dclass.get_field("is_tablet") == "true"){
		set req.http.dclass_type = "tablet";
	} else if(dclass.get_field("is_wireless_device") == "true" && dclass.get_field("inputDevices") == "touchscreen"){
		set req.http.dclass_type = "smartphone";
	} else if(dclass.get_field("is_wireless_device") == "true"){
		set req.http.dclass_type = "phone";
	} else if(dclass.get_field("is_crawler") == "true"){
		set req.http.dclass_type = "crawler";
	} else if(dclass.get_field("is_desktop") == "true"){
		set req.http.dclass_type = "desktop";
	}

	# /uadiag commands
	if(req.url ~ "^/uadiag.js"){
		error 849 "uadiag.js";
	} else if(req.url ~ "^/uadiag"){
		error 848 "uadiag";
	}
}

# add dclass_type to the hash
sub vcl_hash {
	hash_data(req.url);

	if (req.http.host) {
		hash_data(req.http.host);
	} else {
		hash_data(server.ip);
	}

    #use this if you are serving different device content on the same URL
	hash_data(req.http.dclass_type);

	return (hash);
}

sub vcl_error {
	# plain text ua diag
	if(obj.status == 848){
		set obj.status = 200;
		set obj.http.Content-Type = "text/html; charset=utf-8";
		synthetic
{"<title>UADIAG</title>

UADIAG

User-Agent:       "} + req.http.User-Agent + {"

dClass version:   "} + dclass.get_version() + {"

dClass type:      "} + req.http.dclass_type + {"

OpenDDR comment:  "} + dclass.get_comment() + {"
OpenDDR id:       "} + req.http.dclass_openddr + {"
OpenDDR device:   "} + dclass.get_field("vendor") + {" "} + dclass.get_field("model") + {"
OpenDDR display:  "} + dclass.get_ifield("displayWidth") + {"x"} + dclass.get_ifield("displayHeight") + {"
OpenDDR input:    "} + dclass.get_field("inputDevices") + {"
OpenDDR js:       "} + dclass.get_field("ajax_support_javascript") + {"
OpenDDR wireless: "} + dclass.get_field("is_wireless_device") + {"
OpenDDR tablet:   "} + dclass.get_field("is_tablet") + {"
OpenDDR crawler:  "} + dclass.get_field("is_crawler") + {"
OpenDDR desktop:  "} + dclass.get_field("is_desktop") + {"

browser comment:  "} + dclass.get_comment_p(1) + {"
browser id:       "} + req.http.dclass_browser + {"
browser name:     "} + dclass.get_field_p("browser",1) + {"
browser ver:      "} + dclass.get_ifield_p("version",1) + {"
browser os:       "} + dclass.get_field_p("os",1) + {"

"};
		return(deliver);
	}
	# json ua diag with optional jsonp callback parameter
	else if(obj.status == 849){
		set obj.status = 200;
		set req.http.dclass_cb = "";
		set req.http.dclass_cbe = "";
		if(req.url ~ "[^\w]callback=\w+"){
			set obj.http.Content-Type = "application/javascript; charset=utf-8";
			set req.http.dclass_cb = regsub(req.url,"^.*[^\w]callback=(\w+).*","\1(");
			set req.http.dclass_cbe = ");";
		} else {
			set obj.http.Content-Type = "application/json; charset=utf-8";
		}
		synthetic
req.http.dclass_cb + {"{
"user_agent":""} + req.http.User-Agent + {"",
"dclass_version":""} + dclass.get_version() + {"",
"openddr_id":""} + req.http.dclass_openddr + {"",
"openddr_type":""} + req.http.dclass_type + {"",
"openddr_comment":""} + dclass.get_comment() + {"",
"openddr_device":""} + dclass.get_field("vendor") + {" "} + dclass.get_field("model") + {"",
"openddr_display":""} + dclass.get_ifield("displayWidth") + {"x"} + dclass.get_ifield("displayHeight") + {"",
"openddr_input":""} + dclass.get_field("inputDevices") + {"",
"openddr_js":""} + dclass.get_field("ajax_support_javascript") + {"",
"openddr_wireless":""} + dclass.get_field("is_wireless_device") + {"",
"openddr_tablet":""} + dclass.get_field("is_tablet") + {"",
"openddr_crawler":""} + dclass.get_field("is_crawler") + {"",
"openddr_desktop":""} + dclass.get_field("is_desktop") + {"",
"browser_id":""} + req.http.dclass_browser + {"",
"browser_comment":""} + dclass.get_comment_p(1) + {"",
"browser_name":""} + dclass.get_field_p("browser",1) + {"",
"browser_ver":""} + dclass.get_ifield_p("version",1) + {"",
"browser_os":""} + dclass.get_field_p("os",1) + {""
}"} + req.http.dclass_cbe;
		return(deliver);
	}
}

import dclass;
#import urlcode;

backend default {
	.host = "localhost";
	.port = "80";
}

sub vcl_init {
	# load openddr
	dclass.init_dclass("/some/path/dClass/dtrees/openddr.dtree");
	#dclass.init_dclass_p("/some/path/OpenDDR/1.0.0.0/resources",0);

	# load browser dtree
	dclass.init_dclass_p("/some/path/dClass/dtrees/browser.dtree",1);
}

sub vcl_recv {
	# ua override
	if(req.url ~ "[^\w]ua="){
		set req.http.user-agent = regsub(req.url,"^.*[^\w]ua=([^&]*).*","\1");
		#set req.http.user-agent = urlcode.decode(regsub(req.url,"^.*[^\w]ua=([^&]*).*","\1"));
	}

	# do the lookup
	set req.http.dclass_openddr = dclass.classify(req.http.user-agent);
	#set req.http.dclass_openddr = dclass.classify_p(req.http.user-agent,0);
	set req.http.dclass_browser = dclass.classify_p(req.http.user-agent,1);

	# set dclass_type
	set req.http.dclass_type = "unknown";
	if(dclass.get_field("is_tablet") == "true"){
		set req.http.dclass_type = "tablet";
	} else if(dclass.get_field("is_wireless_device") == "true" && dclass.get_field("inputDevices") == "touchscreen"){
		set req.http.dclass_type = "smartphone";
	} else if(dclass.get_field("is_wireless_device") == "true"){
		set req.http.dclass_type = "phone";
	} else if(dclass.get_field("is_crawler") == "true"){
		set req.http.dclass_type = "crawler";
	} else if(dclass.get_field("is_desktop") == "true"){
		set req.http.dclass_type = "desktop";
	}

	# /uadiag commands
	if(req.url ~ "^/uadiag.js"){
		error 849 "uadiag.js";
	} else if(req.url ~ "^/uadiag"){
		error 848 "uadiag";
	}
}

# add dclass_type to the hash
sub vcl_hash {
	hash_data(req.url);

	if (req.http.host) {
		hash_data(req.http.host);
	} else {
		hash_data(server.ip);
	}

    #use this if you are serving different device content on the same URL
	hash_data(req.http.dclass_type);

	return (hash);
}

sub vcl_error {
	# plain text ua diag
	if(obj.status == 848){
		set obj.status = 200;
		set obj.http.Content-Type = "text/html; charset=utf-8";
		synthetic
{"<title>UADIAG</title>

UADIAG

User-Agent:       "} + req.http.User-Agent + {"

dClass version:   "} + dclass.get_version() + {"

dClass type:      "} + req.http.dclass_type + {"

OpenDDR comment:  "} + dclass.get_comment() + {"
OpenDDR id:       "} + req.http.dclass_openddr + {"
OpenDDR device:   "} + dclass.get_field("vendor") + {" "} + dclass.get_field("model") + {"
OpenDDR display:  "} + dclass.get_ifield("displayWidth") + {"x"} + dclass.get_ifield("displayHeight") + {"
OpenDDR input:    "} + dclass.get_field("inputDevices") + {"
OpenDDR js:       "} + dclass.get_field("ajax_support_javascript") + {"
OpenDDR wireless: "} + dclass.get_field("is_wireless_device") + {"
OpenDDR tablet:   "} + dclass.get_field("is_tablet") + {"
OpenDDR crawler:  "} + dclass.get_field("is_crawler") + {"
OpenDDR desktop:  "} + dclass.get_field("is_desktop") + {"

browser comment:  "} + dclass.get_comment_p(1) + {"
browser id:       "} + req.http.dclass_browser + {"
browser name:     "} + dclass.get_field_p("browser",1) + {"
browser ver:      "} + dclass.get_ifield_p("version",1) + {"
browser os:       "} + dclass.get_field_p("os",1) + {"

"};
		return(deliver);
	}
	# json ua diag with optional jsonp callback parameter
	else if(obj.status == 849){
		set obj.status = 200;
		set req.http.dclass_cb = "";
		set req.http.dclass_cbe = "";
		if(req.url ~ "[^\w]callback=\w+"){
			set obj.http.Content-Type = "application/javascript; charset=utf-8";
			set req.http.dclass_cb = regsub(req.url,"^.*[^\w]callback=(\w+).*","\1(");
			set req.http.dclass_cbe = ");";
		} else {
			set obj.http.Content-Type = "application/json; charset=utf-8";
		}
		synthetic
req.http.dclass_cb + {"{
"user_agent":""} + req.http.User-Agent + {"",
"dclass_version":""} + dclass.get_version() + {"",
"openddr_id":""} + req.http.dclass_openddr + {"",
"openddr_type":""} + req.http.dclass_type + {"",
"openddr_device":""} + dclass.get_field("vendor") + {" "} + dclass.get_field("model") + {"",
"openddr_display":""} + dclass.get_ifield("displayWidth") + {"x"} + dclass.get_ifield("displayHeight") + {"",
"openddr_input":""} + dclass.get_field("inputDevices") + {"",
"openddr_js":""} + dclass.get_field("ajax_support_javascript") + {"",
"openddr_wireless":""} + dclass.get_field("is_wireless_device") + {"",
"openddr_tablet":""} + dclass.get_field("is_tablet") + {"",
"openddr_crawler":""} + dclass.get_field("is_crawler") + {"",
"openddr_desktop":""} + dclass.get_field("is_desktop") + {"",
"browser_id":""} + req.http.dclass_browser + {"",
"browser_name":""} + dclass.get_field_p("browser",1) + {"",
"browser_ver":""} + dclass.get_ifield_p("version",1) + {"",
"browser_os":""} + dclass.get_field_p("os",1) + {""
}"} + req.http.dclass_cbe;
		return(deliver);
	}
}


the route '/customer/section/load' added as uncacheable

    # Fixup for Varnish ESI not dealing with https:// absolute URLs well
    if (req.is_esi_subreq && req.url ~ "/https://([^/]+)(/.*)$") {
        set req.http.Host = re.group.1;
        set req.url = re.group.2;
    }

    unset req.http.x-long-cache;

    # Rewrite /static/versionxxxxx URLs. Avoids us having to rewrite on nginx layer
    if (req.url ~ "^/static/version(\d*/)?(.*)$") {
       set req.url = "/static/" + re.group.2 + "?" + re.group.1;
       set req.http.x-long-cache = "1";
    }

    # User's Cookie may contain some Magento Vary items we should vary on
    if (req.http.cookie:X-Magento-Vary ) {
        set req.http.X-Magento-Vary = req.http.cookie:X-Magento-Vary;
    } else {
        unset req.http.X-Magento-Vary;
    }

    # auth for purging
    if (req.request == "FASTLYPURGE") {
      # extract token signature and expiration
      if (!req.http.X-Purge-Token ~ "^([^_]+)_(.*)" ) {
        error 403;
      }

      declare local var.X-Exp STRING;
      declare local var.X-Sig STRING;
      /* extract token expiration and signature */
      set var.X-Exp = re.group.1;
      set var.X-Sig = re.group.2;

      /* validate signature */
      if (var.X-Sig == regsub(digest.hmac_sha1(req.service_id, req.url.path var.X-Exp), "^0x", "")) {
        /* check that expiration time has not elapsed */
        if (time.is_after(now, std.integer2time(std.atoi(var.X-Exp)))) {
          error 410;
        }

      } else {
        error 403;
      }
    }

    # set HTTPS header for offloaded TLS
    if (req.http.Fastly-SSL) {
        set req.http.Https = "on";
    }

    if (req.http.Fastly-FF) {
        # disable ESI processing on Origin Shield
        set req.esi = false;
        # Needed for proper handling of stale while revalidated when shielding is involved
        set req.max_stale_while_revalidate = 0s;
    }

    # geoip lookup
    if (req.url ~ "fastlyCdn/geoip/getaction/") {
        # check if GeoIP has been already processed by client. this normally happens before essential cookies are set.
        if (req.http.cookie:X-Magento-Vary || req.http.cookie:form_key) {
            error 980 "GeoIP already processed";
        } else {
            # append parameter with country code only if it doesn't exist already
            if ( req.url.qs !~ "country_code=" ) {
                set req.url = req.url "?country_code=" if ( req.http.geo_override, req.http.geo_override, client.geo.country_code);
            }
        }
    } else {
        # Per suggestions in https://github.com/sdinteractive/SomethingDigital_PageCacheParams
        # we'll strip out query parameters used in Google AdWords, Mailchimp tracking
        set req.http.Magento-Original-URL = req.url;
        set req.url = querystring.regfilter(req.url, "^(utm_.*|gclid|gdftrk|_ga|mc_.*)");
    }

    # Don't allow clients to force a pass
    if (req.restarts == 0) {
        unset req.http.x-pass;
    }

    # Pass on checkout URLs. Because it's a snippet we want to execute this after backend selection so we handle it
    # in the request condition
    if (req.url ~ "/(catalogsearch|checkout|customer/section/load)") {
        set req.http.x-pass = "1";
    # Pass all admin actions
    } else if ( req.url ~ "^/(index\.php/)?admin(_.*)?/" ) {
        set req.http.x-pass = "1";
    } else {
        # Sort the query arguments to increase cache hit ratio with query arguments that
        # may be out od order
        set req.url = boltsort.sort(req.url);
    }

    # static files are always cacheable. remove SSL flag and cookie
    if (req.url ~ "^/(pub/)?(media|static)/.*") {
        unset req.http.Https;
        unset req.http.Cookie;
    }

    # Fixup for Varnish ESI not dealing with https:// absolute URLs well
    if (req.is_esi_subreq && req.url ~ "/https://([^/]+)(/.*)$") {
        set req.http.Host = re.group.1;
        set req.url = re.group.2;
    }

    unset req.http.x-long-cache;

    # Rewrite /static/versionxxxxx URLs. Avoids us having to rewrite on nginx layer
    if (req.url ~ "^/static/version(\d*/)?(.*)$") {
       set req.url = "/static/" + re.group.2 + "?" + re.group.1;
       set req.http.x-long-cache = "1";
    }

    # User's Cookie may contain some Magento Vary items we should vary on
    if (req.http.cookie:X-Magento-Vary ) {
        set req.http.X-Magento-Vary = req.http.cookie:X-Magento-Vary;
    } else {
        unset req.http.X-Magento-Vary;
    }

    # auth for purging
    if (req.request == "FASTLYPURGE") {
      # extract token signature and expiration
      if (!req.http.X-Purge-Token ~ "^([^_]+)_(.*)" ) {
        error 403;
      }

      declare local var.X-Exp STRING;
      declare local var.X-Sig STRING;
      /* extract token expiration and signature */
      set var.X-Exp = re.group.1;
      set var.X-Sig = re.group.2;

      /* validate signature */
      if (var.X-Sig == regsub(digest.hmac_sha1(req.service_id, req.url.path var.X-Exp), "^0x", "")) {
        /* check that expiration time has not elapsed */
        if (time.is_after(now, std.integer2time(std.atoi(var.X-Exp)))) {
          error 410;
        }

      } else {
        error 403;
      }
    }

    # set HTTPS header for offloaded TLS
    if (req.http.Fastly-SSL) {
        set req.http.Https = "on";
    }

    if (req.http.Fastly-FF) {
        # disable ESI processing on Origin Shield
        set req.esi = false;
        # Needed for proper handling of stale while revalidated when shielding is involved
        set req.max_stale_while_revalidate = 0s;
    }

    # geoip lookup
    if (req.url ~ "fastlyCdn/geoip/getaction/") {
        # check if GeoIP has been already processed by client. this normally happens before essential cookies are set.
        if (req.http.cookie:X-Magento-Vary || req.http.cookie:form_key) {
            error 980 "GeoIP already processed";
        } else {
            # append parameter with country code only if it doesn't exist already
            if ( req.url.qs !~ "country_code=" ) {
                set req.url = req.url "?country_code=" if ( req.http.geo_override, req.http.geo_override, client.geo.country_code);
            }
        }
    } else {
        # Per suggestions in https://github.com/sdinteractive/SomethingDigital_PageCacheParams
        # we'll strip out query parameters used in Google AdWords, Mailchimp tracking
        set req.http.Magento-Original-URL = req.url;
        set req.url = querystring.regfilter(req.url, "^(utm_.*|gclid|gdftrk|_ga|mc_.*)");
    }

    # Don't allow clients to force a pass
    if (req.restarts == 0) {
        unset req.http.x-pass;
    }

    # Pass on checkout URLs. Because it's a snippet we want to execute this after backend selection so we handle it
    # in the request condition
    if (req.url ~ "/(catalogsearch|checkout)") {
        set req.http.x-pass = "1";
    # Pass all admin actions
    } else if ( req.url ~ "^/(index\.php/)?admin(_.*)?/" ) {
        set req.http.x-pass = "1";
    } else {
        # Sort the query arguments to increase cache hit ratio with query arguments that
        # may be out od order
        set req.url = boltsort.sort(req.url);
    }

    # static files are always cacheable. remove SSL flag and cookie
    if (req.url ~ "^/(pub/)?(media|static)/.*") {
        unset req.http.Https;
        unset req.http.Cookie;
    }


varnish: don't leak HTTP cache headers to clients

This fixes issues when a not-logged-id user logs in, but still sees an
old page. This is because the user's browser has cached the page due to
having received it with 'Cache-Control: public, ...' headers. Now we
make varnish overwrite to always set 'Cache-Control: no-cache' so that
clients will always hit the server again.

For not-logged-in users will also always hit the server, but varnish
will still handle the requests directly for as long as it has a valid
cached version of the page.

sub vcl_recv {
  if (req.request == "GET" || req.request == "HEAD") {
    if (req.http.Cookie) {
      # We only care about the "_noosfero_.*" cookies, used by Noosfero
      if (req.http.Cookie !~ "_noosfero_.*" ) {
        # strip all cookies
        unset req.http.Cookie;
      }
    }
  }
}

sub vcl_deliver {
  # Force clients to aways hit the server again for HTML pages
  if (resp.http.Content-Type ~ "^text/html") {
    set resp.http.Cache-Control = "no-cache";
  }
}

sub vcl_error {
    set obj.http.Content-Type = "text/html; charset=utf-8";

    synthetic {"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta http-equiv="refresh" content="60"/>
  <title>Technical problems</title>
  <link rel="stylesheet" type="text/css" href="/designs/themes/default/errors.css"/>
  <link rel="shortcut icon" href='/designs/themes/default/favicon.ico' type="image/x-icon" />

"} + obj.status + " - " + obj.response + {"

Kurzzeitiges Systemproblem

      Unser technisches Team arbeitet gerade daran, bitte probieren Sie es nachher erneut. Wir entschuldigen uns für die Unannehmlichkeiten.

Zurück

Gehe zur Homepage

Temporary system problem

      Our technical team is working on it, please try again later. Sorry for the inconvenience.

Go back

Go to the site home page

Temporary system problem

      Our technical team is working on it, please try again later. Sorry for the inconvenience.

Go back

Go to the site home page

Problème temporaire du système.

      Notre équipe technique est en train d'y travailler. Merci de réessayer plus tard. Nous sommes désolés de la gêne occasionnée.

Retour

Aller à la page d'accueil du site

Temporary system problem

      Our technical team is working on it, please try again later. Sorry for the inconvenience.

Վերադառնալ

Go to the site home page

Problema temporário no sistema

      Nossa equipe técnica está trabalhando nele, por favor tente mais tarde. Perdoe o incoveniente.

Voltar

Ir para a página inicial do site.

Временная ошибка системы

      Техники уже работают над проблемой, пожалуйста, попробуйте позже.

Назад

Перейти на домашнюю страницу сайта

        Deutsch
        English
        Español
        Français
        հայերեն լեզու
        Português
        русский язык

     "};
    return(deliver);
}

sub vcl_recv {
  if (req.request == "GET" || req.request == "HEAD") {
    if (req.http.Cookie) {
      # We only care about the "_noosfero_.*" cookies, used by Noosfero
      if (req.http.Cookie !~ "_noosfero_.*" ) {
        # strip all cookies
        unset req.http.Cookie;
      }
    }
  }
}

sub vcl_error {
    set obj.http.Content-Type = "text/html; charset=utf-8";

    synthetic {"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta http-equiv="refresh" content="60"/>
  <title>Technical problems</title>
  <link rel="stylesheet" type="text/css" href="/designs/themes/default/errors.css"/>
  <link rel="shortcut icon" href='/designs/themes/default/favicon.ico' type="image/x-icon" />

"} + obj.status + " - " + obj.response + {"

Kurzzeitiges Systemproblem

      Unser technisches Team arbeitet gerade daran, bitte probieren Sie es nachher erneut. Wir entschuldigen uns für die Unannehmlichkeiten.

Zurück

Gehe zur Homepage

Temporary system problem

      Our technical team is working on it, please try again later. Sorry for the inconvenience.

Go back

Go to the site home page

Temporary system problem

      Our technical team is working on it, please try again later. Sorry for the inconvenience.

Go back

Go to the site home page

Problème temporaire du système.

      Notre équipe technique est en train d'y travailler. Merci de réessayer plus tard. Nous sommes désolés de la gêne occasionnée.

Retour

Aller à la page d'accueil du site

Temporary system problem

      Our technical team is working on it, please try again later. Sorry for the inconvenience.

Վերադառնալ

Go to the site home page

Problema temporário no sistema

      Nossa equipe técnica está trabalhando nele, por favor tente mais tarde. Perdoe o incoveniente.

Voltar

Ir para a página inicial do site.

Временная ошибка системы

      Техники уже работают над проблемой, пожалуйста, попробуйте позже.

Назад

Перейти на домашнюю страницу сайта

        Deutsch
        English
        Español
        Français
        հայերեն լեզու
        Português
        русский язык

     "};
    return(deliver);
}