Use res.headers.location for obtaining redirect location

When redirecting, target location was obtained from undefined `res.url`.