Rewrite Url and hash

duja at torlen.net duja at torlen.net
Mon Jun 1 16:01:56 CEST 2009


Hi,

Im using varnish to cache certain urls depending on the querystring.

Example, the url looks like this
index.php?var1=123&var2=345&var3=567

but I want the hash to be 
index.php?var1=123

I have succeeded doing this but not 100%.
First of I tried to do the regsub replaces in vcl_hash but understood that this was the wrong because it didnt work as expected.
it got hash correctly but when next request was received it could not be found.

What im doing now is to rewrite the url in vcl_recv, with this the url us hashed and looked up correctly.

But the problem is that the url is sent rewritten to the backend which I dont want :(
How do I solve this? Should I set bereq.url before manipulating req.url?

/ D




More information about the varnish-misc mailing list