diff options
Diffstat (limited to 'vendor/github.com/gorilla/handlers/canonical.go')
-rw-r--r-- | vendor/github.com/gorilla/handlers/canonical.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vendor/github.com/gorilla/handlers/canonical.go b/vendor/github.com/gorilla/handlers/canonical.go index 3961695c4..8437fefc1 100644 --- a/vendor/github.com/gorilla/handlers/canonical.go +++ b/vendor/github.com/gorilla/handlers/canonical.go @@ -18,7 +18,6 @@ type canonical struct { // // Note: If the provided domain is considered invalid by url.Parse or otherwise // returns an empty scheme or host, clients are not re-directed. -// not re-directed. // // Example: // @@ -54,7 +53,11 @@ func (c canonical) ServeHTTP(w http.ResponseWriter, r *http.Request) { if !strings.EqualFold(cleanHost(r.Host), dest.Host) { // Re-build the destination URL dest := dest.Scheme + "://" + dest.Host + r.URL.Path + if r.URL.RawQuery != "" { + dest += "?" + r.URL.RawQuery + } http.Redirect(w, r, dest, c.code) + return } c.h.ServeHTTP(w, r) |