Docs : Only handle actual PURGE HTTP methods, everything else is discarded

AWA SOLUTIONS contact at awa.solutions
Fri Mar 30 15:11:35 UTC 2018


Hi there,

 

While reading the docs, I found this in
https://www.varnish-software.com/wiki/content/tutorials/varnish/sample_vclTe
mplate.html :

 

HANDLING HTTP PURGE

  sub vcl_purge {

    # Only handle actual PURGE HTTP methods, everything else is discarded

    if (req.method != "PURGE") {

      # restart request

      set req.http.X-Purge = "Yes";

      return(restart);

    }

  }

 

 

But in mattiasgeniar/varnish-4.0-configuration-templates
https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/ma
ster/default.vcl 

This is just the opposite logic :

 

sub vcl_purge {

  # Only handle actual PURGE HTTP methods, everything else is discarded

  if (req.method == "PURGE") {

    # restart request

    set req.http.X-Purge = "Yes";

    return (restart);

  }

}

 

So I assume the latter, wiki page, has a typo ?!

 

Last, in
https://book.varnish-software.com/4.0/chapters/Cache_Invalidation.html ,
after similar vcl_recv conditions than above to return purge, vcl_purge
subroutine sets req.method instead of req.http.X-Purge :

 

sub vcl_purge {

    set req.method = "GET";

    return (restart);

}

 

Sounds logical to change req.method to avoid infinite loops, so why isn't it
the same in above examples ?

 

Thank you !

 

	
		
		
		
		
		
		
		

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20180330/08912396/attachment.html>


More information about the varnish-misc mailing list