mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-31 18:41:45 +02:00
Revert "requestbody: Allow overwriting remote address"
This reverts commit 0bf2046da7
.
No actual use case.
This commit is contained in:
parent
160d199999
commit
1ac6351705
1 changed files with 0 additions and 9 deletions
|
@ -29,11 +29,6 @@ func init() {
|
||||||
type RequestBody struct {
|
type RequestBody struct {
|
||||||
// The maximum number of bytes to allow reading from the body by a later handler.
|
// The maximum number of bytes to allow reading from the body by a later handler.
|
||||||
MaxSize int64 `json:"max_size,omitempty"`
|
MaxSize int64 `json:"max_size,omitempty"`
|
||||||
|
|
||||||
// Overwrites the remote address from which the request came. This is destructive;
|
|
||||||
// handlers later in the chain will not be able to recover the true originating
|
|
||||||
// address of the request. EXPERIMENTAL: May get changed or removed later.
|
|
||||||
RemoteAddress string `json:"remote_address,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CaddyModule returns the Caddy module information.
|
// CaddyModule returns the Caddy module information.
|
||||||
|
@ -45,10 +40,6 @@ func (RequestBody) CaddyModule() caddy.ModuleInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rb RequestBody) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
|
func (rb RequestBody) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
|
||||||
if rb.RemoteAddress != "" {
|
|
||||||
repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
|
|
||||||
r.RemoteAddr = repl.ReplaceAll(rb.RemoteAddress, "")
|
|
||||||
}
|
|
||||||
if r.Body == nil {
|
if r.Body == nil {
|
||||||
return next.ServeHTTP(w, r)
|
return next.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue