<div dir="ltr">Hi,<div><br></div><div>We are using the default.vcl file as follows. Our website is getting higher traffic each day but there is a decline in ads' impression values. We are using .js in ad codes. Do you think the following settings might be the problem?<br></div><div><br></div><div><div>/* SET THE HOST AND PORT OF WORDPRESS</div><div> * *********************************************************/</div><div>vcl 4.0;</div><div>import std;</div><div><br></div><div>backend default {</div><div> .host = "********";</div><div> .port = "8080";</div><div> .connect_timeout = 600s;</div><div> .first_byte_timeout = 600s;</div><div> .between_bytes_timeout = 600s;</div><div> .max_connections = 800;</div><div> }</div><div> </div><div> # SET THE ALLOWED IP OF PURGE REQUESTS</div><div> # ##########################################################</div><div> acl purge {</div><div> "localhost";</div><div> "127.0.0.1";</div><div> }</div><div><br></div><div> #THE RECV FUNCTION</div><div> # ##########################################################</div><div> sub vcl_recv {</div><div> if (req.http.Host == "****.com/forum" || req.url ~ "forum") {</div><div>return (pass);</div><div>}</div><div><br></div><div> # set realIP by trimming CloudFlare IP which will be used for various checks</div><div> set req.http.X-Actual-IP = regsub(req.http.X-Forwarded-For, "[, ].*$", ""); </div><div><br></div><div> # FORWARD THE IP OF THE REQUEST</div><div> if (req.restarts == 0) {</div><div> if (req.http.x-forwarded-for) {</div><div> set req.http.X-Forwarded-For =</div><div> req.http.X-Forwarded-For + ", " + client.ip;</div><div> } else {</div><div> set req.http.X-Forwarded-For = client.ip;</div><div> }</div><div> }</div><div><br></div><div> # Purge request check sections for hash_always_miss, purge and ban</div><div> # BLOCK IF NOT IP is not in purge acl</div><div> # ##########################################################</div><div><br></div><div> # Enable smart refreshing using hash_always_miss</div><div> if (req.http.Cache-Control ~ "no-cache") {</div><div> if (client.ip ~ purge || !std.ip(req.http.X-Actual-IP, "1.2.3.4") ~ purge) {</div><div> set req.hash_always_miss = true;</div><div> }</div><div> }</div><div><br></div><div> if (req.method == "PURGE") {</div><div> if (!client.ip ~ purge || !std.ip(req.http.X-Actual-IP, "1.2.3.4") ~ purge) {</div><div> return(synth(405,"Not allowed."));</div><div> }</div><div> return (purge);</div><div><br></div><div> }</div><div> if (req.method == "BAN") {</div><div> # Same ACL check as above:</div><div> if (!client.ip ~ purge || !std.ip(req.http.X-Actual-IP, "1.2.3.4") ~ purge) {</div><div> return(synth(403, "Not allowed."));</div><div> }</div><div> ban("req.http.host == " + req.http.host +</div><div> " && req.url == " + req.url);</div><div><br></div><div> # Throw a synthetic page so the</div><div> # request won't go to the backend.</div><div> return(synth(200, "Ban added"));</div><div>}</div><div><br></div><div><br></div><div># Unset cloudflare cookies</div><div># Remove has_js and CloudFlare/Google Analytics __* cookies.</div><div> set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");</div><div> # Remove a ";" prefix, if present.</div><div> set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");</div><div><br></div><div> # For Testing: If you want to test with Varnish passing (not caching) uncomment</div><div> # return( pass );</div><div><br></div><div> # FORWARD THE IP OF THE REQUEST</div><div> if (req.restarts == 0) {</div><div> if (req.http.x-forwarded-for) {</div><div> set req.http.X-Forwarded-For =</div><div> req.http.X-Forwarded-For + ", " + client.ip;</div><div> } else {</div><div> set req.http.X-Forwarded-For = client.ip;</div><div> }</div><div> }</div><div><br></div><div> # DO NOT CACHE RSS FEED</div><div> if (req.url ~ "/feed(/)?") {</div><div> return ( pass ); </div><div> }</div><div><br></div><div> ## Do not cache search results, comment these 3 lines if you do want to cache them</div><div><br></div><div> if (req.url ~ "/\?s\=") {</div><div> return ( pass ); </div><div> }</div><div><br></div><div># CLEAN UP THE ENCODING HEADER.</div><div> # SET TO GZIP, DEFLATE, OR REMOVE ENTIRELY. WITH VARY ACCEPT-ENCODING</div><div> # VARNISH WILL CREATE SEPARATE CACHES FOR EACH</div><div> # DO NOT ACCEPT-ENCODING IMAGES, ZIPPED FILES, AUDIO, ETC.</div><div> # ##########################################################</div><div> if (req.http.Accept-Encoding) {</div><div> if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {</div><div> # No point in compressing these</div><div> unset req.http.Accept-Encoding;</div><div> } elsif (req.http.Accept-Encoding ~ "gzip") {</div><div> set req.http.Accept-Encoding = "gzip";</div><div> } elsif (req.http.Accept-Encoding ~ "deflate") {</div><div> set req.http.Accept-Encoding = "deflate";</div><div> } else {</div><div> # unknown algorithm</div><div> unset req.http.Accept-Encoding;</div><div> }</div><div> }</div><div><br></div><div> # PIPE ALL NON-STANDARD REQUESTS</div><div> # ##########################################################</div><div> if (req.method != "GET" &&</div><div> req.method != "HEAD" &&</div><div> req.method != "PUT" && </div><div> req.method != "POST" &&</div><div> req.method != "TRACE" &&</div><div> req.method != "OPTIONS" &&</div><div> req.method != "DELETE") {</div><div> return (pipe);</div><div> }</div><div> </div><div> # ONLY CACHE GET AND HEAD REQUESTS</div><div> # ##########################################################</div><div> if (req.method != "GET" && req.method != "HEAD") {</div><div> return (pass);</div><div> }</div><div> </div><div> # OPTIONAL: DO NOT CACHE LOGGED IN USERS (THIS OCCURS IN FETCH TOO, EITHER</div><div> # COMMENT OR UNCOMMENT BOTH</div><div> # ##########################################################</div><div> if ( req.http.cookie ~ "wordpress_logged_in" ) {</div><div> return( pass );</div><div> }</div><div> </div><div> # IF THE REQUEST IS NOT FOR A PREVIEW, WP-ADMIN OR WP-LOGIN</div><div> # THEN UNSET THE COOKIES</div><div> # ##########################################################</div><div> if (!(req.url ~ "wp-(login|admin)") </div><div> && !(req.url ~ "&preview=true" ) </div><div> ){</div><div> unset req.http.cookie;</div><div> }</div><div><br></div><div> # IF BASIC AUTH IS ON THEN DO NOT CACHE</div><div> # ##########################################################</div><div> if (req.http.Authorization || req.http.Cookie) {</div><div> return (pass);</div><div> }</div><div> </div><div> # IF YOU GET HERE THEN THIS REQUEST SHOULD BE CACHED</div><div> # ##########################################################</div><div> return (hash);</div><div> # This is for phpmyadmin</div><div> if (req.http.Host == "<a href="http://ki1.org">ki1.org</a>") {</div><div> return (pass);</div><div> }</div><div><br></div><div> if (req.http.Host == "<a href="http://mysql.ki1.org">mysql.ki1.org</a>") {</div><div> return (pass);</div><div> }</div><div><br></div><div> }</div><div><br></div><div># HIT FUNCTION</div><div># ##########################################################</div><div>sub vcl_hit {</div><div> # IF THIS IS A PURGE REQUEST THEN DO THE PURGE</div><div> # ##########################################################</div><div> if (req.method == "PURGE") {</div><div> #</div><div> # This is now handled in vcl_recv.</div><div> #</div><div> # purge;</div><div> return (synth(200, "Purged."));</div><div> }</div><div> return (deliver);</div><div>}</div><div><br></div><div># MISS FUNCTION</div><div># ##########################################################</div><div>sub vcl_miss {</div><div> if (req.method == "PURGE") {</div><div> #</div><div> # This is now handled in vcl_recv.</div><div> #</div><div> # purge;</div><div> return (synth(200, "Purged."));</div><div> }</div><div> return (fetch);</div><div>}</div><div><br></div><div># FETCH FUNCTION</div><div># ##########################################################</div><div>sub vcl_backend_response {</div><div> # I SET THE VARY TO ACCEPT-ENCODING, THIS OVERRIDES W3TC </div><div> # TENDANCY TO SET VARY USER-AGENT. YOU MAY OR MAY NOT WANT</div><div> # TO DO THIS</div><div> # ##########################################################</div><div> set beresp.http.Vary = "Accept-Encoding";</div><div><br></div><div> # IF NOT WP-ADMIN THEN UNSET COOKIES AND SET THE AMOUNT OF </div><div> # TIME THIS PAGE WILL STAY CACHED (TTL)</div><div> # ##########################################################</div><div> if (!(bereq.url ~ "wp-(login|admin)|forum") && !bereq.http.cookie ~ "wordpress_logged_in" && !bereq.http.host == "******.com/forum" ) {</div><div> unset beresp.http.set-cookie;</div><div> set beresp.ttl = 52w;</div><div># set beresp.grace =1w;</div><div> }</div><div> </div><div><br></div><div><br></div><div> if (beresp.ttl <= 0s ||</div><div> beresp.http.Set-Cookie ||</div><div> beresp.http.Vary == "*") {</div><div> set beresp.ttl = 120 s;</div><div> # set beresp.ttl = 120s;</div><div> set beresp.uncacheable = true;</div><div> return (deliver);</div><div> }</div><div><br></div><div> return (deliver);</div><div>}</div><div><br></div><div># DELIVER FUNCTION</div><div># ##########################################################</div><div>sub vcl_deliver {</div><div> # IF THIS PAGE IS ALREADY CACHED THEN RETURN A 'HIT' TEXT </div><div> # IN THE HEADER (GREAT FOR DEBUGGING)</div><div> # ##########################################################</div><div> if (obj.hits > 0) {</div><div> set resp.http.X-Cache = "HIT";</div><div> # IF THIS IS A MISS RETURN THAT IN THE HEADER</div><div> # ##########################################################</div><div> } else {</div><div> set resp.http.X-Cache = "MISS";</div><div> }</div><div>}</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-16 19:42 GMT+03:00 Guillaume Quintard <span dir="ltr"><<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Maybe, what is it supposed to do, why is it there and is any of your ad frameworks affected by this?</p>
</blockquote></div><br></div>