fix router handling when setting a location response header (#82588)
When middleware sets a `Location` header on the response, we should not
assume that the target URL is the one we want to handle the request. We
only want to route to the underlying location header when a rewrite is
explicitly triggered rather than relying on the presence of the response
header.
---------
Co-authored-by: JJ Kasper <jj@jjsweb.site>