Weird "^" in the regex of varnish

Bjørn Ruberg bjorn at ruberg.no
Tue Mar 8 07:20:47 CET 2011


On 03/08/2011 06:22 AM, Junxian Yan wrote:
> I upgraded varnish to 2.1.5 and used log function to trace the req.url
> and found there was host name in 'req.url'. But I didn't find any more
> description about this format in wiki.
> So I have to do a regsub before entering every function.  Dose it make
> sense?
>
> Below is varnish log,
>
>      0 CLI          - Rd ping
>      0 CLI          - Wr 200 19 PONG 1299561539 1.0
>     12 SessionOpen  c 10.0.2.130 56799 :6081
>     12 ReqStart     c 10.0.2.130 56799 1589705637
>     12 RxRequest    c GET
>     12 RxURL        c
> http://staging.test.com/purge/tables/vyulrh/summary.js?grid_state_id=3815

Different User-Agents send different req.url. To normalize them, see

http://www.varnish-cache.org/trac/wiki/VCLExampleNormalizingReqUrl

Note that technically, there's nothing wrong with using hostnames in 
req.url, apart from possibly storing the same object under different 
names. However, as you have found out, some regular expressions might 
not work as intended until you normalize req.url.

-- 
Bjørn





More information about the varnish-misc mailing list