<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi there,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>While reading the docs, I found this in <a href="https://www.varnish-software.com/wiki/content/tutorials/varnish/sample_vclTemplate.html">https://www.varnish-software.com/wiki/content/tutorials/varnish/sample_vclTemplate.html</a> :<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US>HANDLING HTTP PURGE<o:p></o:p></span></b></p><p class=MsoNormal><span lang=EN-US>  sub vcl_purge {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    <i># Only handle actual PURGE HTTP methods, everything else is discarded</i><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    <b>if</b> (req.method != "PURGE") {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>      <i># restart request</i><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>      set req.http.X-Purge = "Yes";<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>      </span><b>return</b>(restart);<o:p></o:p></p><p class=MsoNormal>    }<o:p></o:p></p><p class=MsoNormal>  }<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>But in mattiasgeniar/varnish-4.0-configuration-templates <a href="https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl">https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl</a> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>This is just the opposite logic :<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>sub vcl_purge {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>  # <i>Only handle actual PURGE HTTP methods, everything else is discarded</i><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>  if (req.method == "PURGE") {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    # <i>restart request<o:p></o:p></i></span></p><p class=MsoNormal><span lang=EN-US>    set req.http.X-Purge = "Yes";<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>    return (restart);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>  }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>So I assume the latter, wiki page, has a typo ?!<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Last, in <a href="https://book.varnish-software.com/4.0/chapters/Cache_Invalidation.html">https://book.varnish-software.com/4.0/chapters/Cache_Invalidation.html</a> , after similar vcl_recv conditions than above to return purge, vcl_purge subroutine sets req.method instead of req.http.X-Purge :<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>sub vcl_purge {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>    set req.method = "GET";<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>    return (restart);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Sounds logical to change req.method to avoid infinite loops, so why isn’t it the same in above examples ?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Thank<span style='color:#1F497D'> you !</span><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 style='background:white;border-collapse:collapse'><tr><td valign=top style='padding:0cm 6.0pt 0cm 6.0pt'></td></tr><tr><td width=50 nowrap valign=top style='width:29.75pt;padding:0cm 6.0pt 0cm 6.0pt'></td><td valign=top style='padding:0cm 6.0pt 0cm 6.0pt'></td></tr><tr><td width=50 nowrap valign=top style='width:29.75pt;padding:0cm 6.0pt 0cm 6.0pt'></td><td valign=top style='padding:0cm 6.0pt 0cm 6.0pt'></td></tr><tr><td width=50 nowrap valign=top style='width:29.75pt;padding:0cm 6.0pt 0cm 6.0pt'></td><td valign=top style='padding:0cm 6.0pt 0cm 6.0pt'></td></tr><tr><td width=50 nowrap valign=top style='width:29.75pt;padding:0cm 6.0pt 0cm 6.0pt'></td><td valign=top style='padding:0cm 6.0pt 0cm 6.0pt'></td></tr><tr><td width=50 nowrap valign=top style='width:29.75pt;padding:0cm 6.0pt 0cm 6.0pt'></td><td valign=top style='padding:0cm 6.0pt 0cm 6.0pt'></td></tr><tr><td width=50 nowrap valign=top style='width:29.75pt;padding:0cm 6.0pt 0cm 6.0pt'></td><td valign=top style='padding:0cm 6.0pt 0cm 6.0pt'></td></tr><tr><td width=50 nowrap valign=top style='width:29.75pt;padding:0cm 6.0pt 0cm 6.0pt'></td><td valign=top style='padding:0cm 6.0pt 0cm 6.0pt'></td></tr></table><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>