Merge pull request #216 from matrix-org/rav/fix_speculator_redirects
Add a host and scheme to Location headers in redirects
This commit is contained in:
commit
d1d3d27e2f
1 changed files with 6 additions and 2 deletions
|
@ -387,8 +387,12 @@ func (s *server) serveSpec(w http.ResponseWriter, req *http.Request) {
|
|||
w.Write([]byte("Not found"))
|
||||
}
|
||||
|
||||
func (s *server) redirectTo(w http.ResponseWriter, _ *http.Request, path string) {
|
||||
w.Header().Set("Location", path)
|
||||
func (s *server) redirectTo(w http.ResponseWriter, req *http.Request, path string) {
|
||||
u := *req.URL
|
||||
u.Scheme = "http"
|
||||
u.Host = req.Host
|
||||
u.Path = path
|
||||
w.Header().Set("Location", u.String())
|
||||
w.WriteHeader(302)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue