<div dir="ltr">Please provide the varnishlog output for a request seen leading to the described issue. There are multiple sections in which cookies are unset, where you could be triggering this behavior.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 20, 2017 at 4:47 AM, Christopher Edwards <span dir="ltr"><<a href="mailto:Christopher@hippomotorgroup.co.uk" target="_blank">Christopher@hippomotorgroup.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="m_-3981904117096469562WordSection1">
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">When a user tries to upload content via our CMS, we're getting a incorrect permissions due to PHPSESSID not being sent.<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">Here is my current vcl file, what would I have to change to resolve the PHPSESSID error?<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">As an alternative to resolving this issue (not ideal) set a section of the site to not be cached by varnish but I'm also not sure of how to do that.</span><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0cm;background:#eff0f1"><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">vcl 4.0;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">import directors;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">import std;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">backend site1 {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> .host = "127.0.0.1";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> .port = "8080";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">backend site2 {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> .host = "127.0.0.1";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> .port = "8081";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">backend site3 {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> .host = "127.0.0.1";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> .port = "8082";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">acl purge {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> "localhost";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> "127.0.0.1";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">sub vcl_recv {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # SINGLE BACKEND<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"># set req.backend_hint= default;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">if (req.http.host == "<a href="http://www.site2.co.uk" target="_blank">www.site2.co.uk</a>") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set req.backend_hint = site2;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }
<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> else if (req.http.host == "<a href="http://www.site3.co.uk" target="_blank">www.site3.co.uk</a>") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set req.backend_hint = site3;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }
<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> else if (req.http.host == "<a href="http://site1.site2.co.uk" target="_blank">site1.site2.co.uk</a>") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set req.backend_hint = site1;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }
<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> else {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return (synth(404, "Host not found"));<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # SET HTTP HEADERS<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set req.http.X-Forwarded-For = client.ip;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set req.http.X-Forwarded-Proto = "https";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # REMOVE HEADERS THAT MIGHT DUPLICATE CACHE<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> unset req.http.Accept-Language;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> unset req.http.User-Agent;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # PURGE<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (req.method == "PURGE") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (!client.ip ~ purge) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(synth(405,"Not allowed."));<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return (purge);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if ( std.port(server.ip) == 6080) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set req.http.x-redir = "https://" + req.http.host + req.url;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return (synth(750, "Moved permanently"));<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # DROP COOKIES AND PARAMS FROM STATIC ASSET<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (req.url ~ "\.(gif|jpg|jpeg|swf|ttf|css|<wbr>js|flv|mp3|mp4|pdf|ico|png)(\?<wbr>.*|)$") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> unset req.http.cookie;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set req.url = regsub(req.url, "\?.*$", "");<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # PASS COOKIES<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (req.http.cookie) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (req.http.cookie ~ "(exclude_)") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(pass);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> } else {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> unset req.http.cookie;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">sub vcl_backend_response {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # RETRY BACKEND 3 TIMES IF DOWN<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (beresp.status == 503 && bereq.retries < 3 ) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(retry);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (bereq.http.Cookie ~ "(UserID|_session)") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.http.X-Cacheable = "NO:Got Session";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.uncacheable = true;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return (deliver);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> } elsif (beresp.ttl <= 0s) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.http.X-Cacheable = "YES";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> } elsif (beresp.http.set-cookie) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.http.X-Cacheable = "YES";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.uncacheable = false;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return (deliver);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> } elsif (beresp.http.Cache-Control ~ "private") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.http.X-Cacheable = "NO:Cache-Control=private";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.uncacheable = true;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return (deliver);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> } else {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.http.X-Cacheable = "YES";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> unset beresp.http.expires;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.http.cache-control = "max-age=900";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.ttl = 1w;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.http.magicmarker = "1";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # UNSET COOKIES<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (!(bereq.url ~ "(exclude)")) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.http.X-UnsetCookies = "TRUE";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> unset beresp.http.set-cookie;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.ttl = 1h;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # YEAR LONG CACHE FILE TYPES<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (bereq.url ~ "\.(gif|jpg|jpeg|png)(\?.*|)$"<wbr>) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.ttl = 365d;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # MONTH LONG CACHE FILE TYPES<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (bereq.url ~ "\.(css|js|flv|mp3|mp4|pdf|)(\<wbr>?.*|)$") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set beresp.ttl = 30d;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">set beresp.grace = 1w;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">sub vcl_hash {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if ( req.http.X-Forwarded-Proto ) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> hash_data( req.http.X-Forwarded-Proto );<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">sub vcl_backend_error {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # DISPAY CUSTOM ERROR IF FAILS<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (beresp.status == 503 && bereq.retries == 3) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> synthetic(std.fileread("/etc/<wbr>varnish/error503.html"));<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(deliver);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">sub vcl_synth {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # REDIRECT FOR HTTP<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (resp.status == 750) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set resp.status = 301;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set resp.http.Location = req.http.x-redir;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(deliver);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"># DISPLAY CUSTOM PAGE IF BACKEND DOWN<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (resp.status == 503) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> synthetic(std.fileread("/etc/<wbr>varnish/error503.html"));<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(deliver);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">sub vcl_deliver {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # RESTART IF BACKEND DOWN<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (resp.status == 503) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(restart);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (resp.http.magicmarker) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # REMOVE MAGIC MARK<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> unset resp.http.magicmarker;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> # FRESH OBJECT<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set resp.http.age = "0";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (obj.hits > 0) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set resp.http.X-Cache = "HIT";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> } else {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set resp.http.X-Cache = "MISS";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> set resp.http.Access-Control-<wbr>Allow-Origin = "*";<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">sub vcl_hit {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (req.method == "PURGE") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(synth(200,"OK"));<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">sub vcl_miss {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> if (req.method == "PURGE") {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> return(synth(404,"Not cached"));<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729"> }<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:10.0pt;font-family:Consolas;color:#242729">}<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/<wbr>varnish-misc</a><br></blockquote></div><br></div>