Exclude a URL

Kristian Lyngstol kristian at varnish-software.com
Wed Jan 12 14:24:52 CET 2011


On Wed, Jan 12, 2011 at 12:16:34PM +0100, Eduardo Gimenez Ruiz wrote:
> In the first time I will like to say that my English is not very
> good, sorry for that. I will try to explain my question for is some
> person can help me.

Don't worry about your English - if you do your best, we are happy :)

> I use a Varnish Version 1.1.2 with pressflow (a kind of drupal) and
> i try to exclude a URL (or a path) from the cache.

I strongly advice you to upgrade. Version 1.1.2 is very old and all the
documentation on the wiki and /docs/ is for Varnish 2.1 (Or some for
Varnish 2.0). Varnish 2.1 also fixes many known bugs.

> I use this configuration in my default.vcl:
> 
> sub vcl_recv {
>   if (req.url ~ "^/portal/ajax_user_bar") {
>      //return (pass);
>      //pass;
>      unset req.http.cookie;
>   }
> [other code]
> }
> 
> And in all case I see this result with "varnishtop -b -i TxURL" is:
> 
> 1.00 TxURL     /portal/ajax_user_bar/login?0.9301228949334472
> 
> The number after the "login?" are a ramdom number from the code and
> the "ajax_user_bar" is a module in pressflow not a directory of the
> OS.

It looks OK. You are removing a cookie, and the URL will not change because
of that. The number 1 also means that only 1 backend request was seen for
that URL for quite some time. Look at varnishlog -o -b to see if the Cookie
header is removed or not.

Varnish can also change the url, if that is what you want.

> I tried to use a "return (pass);", "pass;" and "unset
> req.http.cookie;" (like the example in a tutorial:
> http://www.varnish-cache.org/docs/2.1/tutorial/vcl.html) but I can't
> exclude the URL.

Much of this will not work on Varnish 1.1.2, because the examples and
documentation is written for Varnish 2.0 or newer. It will be much easier
to help you if you upgrade.

There is a package repository at http://repo.varnish-cache.org for
Debian, Ubuntu and CentOS/RHEL packages.

Hope this helps :)

- Kristian




More information about the varnish-misc mailing list