try_files, rewrite: allow query string in try_files (fix #2891)

Also some minor cleanup/improvements discovered along the way
This commit is contained in:
Matthew Holt 2019-12-12 15:27:09 -07:00
parent 09a8517065
commit 5e9d81b507
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
4 changed files with 57 additions and 23 deletions

View file

@ -190,11 +190,6 @@ func (rep replacer) do(r *http.Request, repl caddy.Replacer) bool {
r.URL.Path = strings.Replace(oldPath, find, replace, lim)
r.URL.RawQuery = strings.Replace(oldQuery, find, replace, lim)
// changed := r.URL.Path != oldPath && r.URL.RawQuery != oldQuery
// if changed {
// r.RequestURI = r.URL.RequestURI()
// }
return r.URL.Path != oldPath && r.URL.RawQuery != oldQuery
}