req.url in vcl_recv

Hauke Lampe lampe at
Wed Oct 12 12:21:04 CEST 2011

Hi Jeff.

On 12.10.2011 06:01, Stroomer, Jeff wrote:

> I've seen plenty of example vcl code that seems to say req.url will
contain /a/b/c.
> But it looks like I'm actually getting the full URL, i.e.,

If you see that in each and every request, I'd suspect another reverse
proxy or load balancer at your end.

I see this request format, too, occasionally, but I haven't tried to
figure out which browsers/bot actually cause it.

I use this code in vcl_recv() to normalize the URL:

# fix "GET http://host/path" request
# extract Host: header and rewrite URL
if (req.url ~ "(?i)^https?://") {
	set req.http.Host = regsub(req.url, "(?i)^https?://([^/]*).*", "\1");
	set req.url = regsub(req.url, "(?i)^https?://[^/]*/?(.*)$", "/\1");

( )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the varnish-misc mailing list