varnish changes HEAD to GET on backend request

Poul-Henning Kamp phk at
Wed Apr 14 17:52:22 CEST 2010

In message <1271259971.28720.86.camel at oasis>, Taylan Develioglu writes:

>The default behavior of varnish 2.1 seems to be changing HEAD requests
>into GET before sending them to the backend.

Yes, in the vcl_miss{} path, varnish currently only uses GET to the
backend, the presumption is that if we get a HEAD request, we're
also likely to need the object body soon after.

> sub vcl_pass {
>     if (req.request == "HEAD") {
>         set bereq.request = "HEAD";
>     }
> }

A HEAD being pass'ed will go unmodified to the backend, so this
should do nothing

> sub vcl_miss {
>     if (req.request == "HEAD") {
>         set bereq.request = "HEAD";
>     }
> }

This will confused varnish program logic, and do nothing good.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-misc mailing list