mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
caddyhttp: Restore original request params before error handlers (#3781)
* caddyhttp: Restore original request params before error handlers Fixes #3717 * Add comment
This commit is contained in:
parent
c7efb0307d
commit
385adf5d87
1 changed files with 8 additions and 0 deletions
|
@ -209,6 +209,14 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
// restore original request before invoking error handler chain (issue #3717)
|
||||
// TODO: this does not restore original headers, if modified (for efficiency)
|
||||
origReq := r.Context().Value(OriginalRequestCtxKey).(http.Request)
|
||||
r.Method = origReq.Method
|
||||
r.RemoteAddr = origReq.RemoteAddr
|
||||
r.RequestURI = origReq.RequestURI
|
||||
cloneURL(origReq.URL, r.URL)
|
||||
|
||||
// prepare the error log
|
||||
logger := errLog
|
||||
if s.Logs != nil {
|
||||
|
|
Loading…
Reference in a new issue