req.url modified in restart?
Jesper Larsen
jla at fcoo.dk
Wed Apr 26 15:31:18 CEST 2017
Hi Varnish people
I use something like this snippet:
sub vcl_recv {
if (req.url ~ "^\/foo\/") {
set req.url = regsub(req.url, "^\/foo\/", "/");
set req.backend_hint = special_backend;
}
}
for rewriting req.url before sending the request to the backend. As you can see I simply remove the first portion of the path before sending the request to the backend. For urls not matching the regex I do not change req.url. I have also enabled restarts. I am using the original url in vcl_hash.
But I have noticed that when the "special_backend" is down my default backend gets the request. I suppose the reason is that I have modified req.url. And when the request is restarted it uses this modified url which does not start with "/foo/".
My question is: What would you recommend that I do to avoid this? Should I modify the url in another subroutine?
Best regards,
Jesper
More information about the varnish-misc
mailing list