<p dir="ltr">Try removing the headers bits and the accept-encoding parts, varnish default behavior should be enough.</p>
<p dir="ltr">And if that doesn't help, you really need to understand what is going on on the advertising side of things.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Aug 31, 2016 21:42, "Ayberk Kimsesiz" <<a href="mailto:ayberk.kimsesiz@gmail.com">ayberk.kimsesiz@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Guillaume,<div><br></div><div>Varnish truly has a serious affect on impressions of banners. This month was a substantial lost. What is your advise on this? </div><div>We are very pleased with Varnish but also experiencing a loss of income.<br></div><div><br></div><div>Ad code: </div><div><br></div><div><script data-adfscript="<a href="http://adx.adform.net/adx/?mid=220975&rnd=%%ADFRND%%" target="_blank">adx.adform.<wbr>net/adx/?mid=220975&rnd=%%<wbr>ADFRND%%</a>"></script> </div><div><script src="//<a href="http://s1.adform.net/banners/scripts/adx.js" target="_blank">s1.adform.net/banners/<wbr>scripts/adx.js</a>" async defer></script></div><div><br></div><div>Thanks,</div><div>Ayberk</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-22 14:10 GMT+03:00 Ayberk Kimsesiz <span dir="ltr"><<a href="mailto:ayberk.kimsesiz@gmail.com" target="_blank">ayberk.kimsesiz@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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> * ******************************<wbr>***************************/</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> # ##############################<wbr>############################</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> # ##############################<wbr>############################</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-Fo<wbr>r, "[, ].*$", ""); </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> # ##############################<wbr>############################</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><span><div> set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;<wbr>]*", "");</div><div> # Remove a ";" prefix, if present.</div><div> set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");</div><div><br></div></span><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> # ##############################<wbr>############################</div><div> if (req.http.Accept-Encoding) {</div><div> if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz<wbr>|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> # ##############################<wbr>############################</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> # ##############################<wbr>############################</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> # ##############################<wbr>############################</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> # ##############################<wbr>############################</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> # ##############################<wbr>############################</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> # ##############################<wbr>############################</div><div> return (hash);</div><div> # This is for phpmyadmin</div><div> if (req.http.Host == "<a href="http://ki1.org" target="_blank">ki1.org</a>") {</div><div> return (pass);</div><div> }</div><div><br></div><div> if (req.http.Host == "<a href="http://mysql.ki1.org" target="_blank">mysql.ki1.org</a>") {</div><div> return (pass);</div><div> }</div><div><br></div><div> }</div><div><br></div><div># HIT FUNCTION</div><div># ##############################<wbr>############################</div><div>sub vcl_hit {</div><div> # IF THIS IS A PURGE REQUEST THEN DO THE PURGE</div><div> # ##############################<wbr>############################</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># ##############################<wbr>############################</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># ##############################<wbr>############################</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> # ##############################<wbr>############################</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> # ##############################<wbr>############################</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># ##############################<wbr>############################</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> # ##############################<wbr>############################</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> # ##############################<wbr>############################</div><div> } else {</div><div> set resp.http.X-Cache = "MISS";</div><div> }</div><div>}</div></div><div><br></div></div><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.co<wbr>m</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>
</div></div></blockquote></div><br></div>
</blockquote></div></div>