[#60401480] Cache headers for exact redirects

Cribbed `http.redirectHandler` from stdlib so that we can insert additional
headers onto `http.ResponseWriter` before calling `http.Redirect()`.

Moved the addition of header to a function, common to both, which modifies
the `ResponseWriter` in-place.