varnishd -a addr:8001,addr:8002 -- Share same cache?

Shenton, Chris (HQ-LM020)[INDYNE INC] chris.shenton at
Tue Mar 8 18:11:39 CET 2011

On Mar 7, 2011, at 4:48 PM, Jim Hayter wrote:

> In my environment, port numbers may be on the request, but are not needed to respond nor should they influence the cache.  In my vcl_recv, I have the following lines:
>    /* determine vhost name w/out port number */
>    set req.http.newhost = regsub(, "([^:]*)(:.*)?$", "\1");
>    set = req.http.newhost;
> This strips off the port number from the host name in the request.  Doing it this way, the port number is discarded and NOT passed on to the application.  It is also not present when creating and looking up hash entries.  

This looks like it does exactly what we need.  I thought I was going have to monkey with server.port, or what the vcl_hash includes in its key calculation, but this is straight-forward.

Thanks a lot, Jim.

More information about the varnish-misc mailing list