@marcel91200 / caddy Mirror · read-only / commits / 1ac63517
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

Revert "requestbody: Allow overwriting remote address"

This reverts commit 0bf2046da7f2f5bf1b7d9fa055ae28de9a06ddaf. No actual use case.

Matthew Holt committed Jan 11, 2021 at 13:35 UTC 1ac6351705e06316d261d2d1cc926ce33d6f23b4
1 file changed -9
modules/caddyhttp/requestbody/requestbody.go
-9
@@ -29,11 +29,6 @@ func init() {
29 type RequestBody struct {
30 // The maximum number of bytes to allow reading from the body by a later handler.
31 MaxSize int64 `json:"max_size,omitempty"`
32 -
33 - // Overwrites the remote address from which the request came. This is destructive;
34 - // handlers later in the chain will not be able to recover the true originating
35 - // address of the request. EXPERIMENTAL: May get changed or removed later.
36 - RemoteAddress string `json:"remote_address,omitempty"`
32 }
33
34 // CaddyModule returns the Caddy module information.
@@ -45,10 +40,6 @@ func (RequestBody) CaddyModule() caddy.ModuleInfo {
40 }
41
42 func (rb RequestBody) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
48 - if rb.RemoteAddress != "" {
49 - repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
50 - r.RemoteAddr = repl.ReplaceAll(rb.RemoteAddress, "")
51 - }
43 if r.Body == nil {
44 return next.ServeHTTP(w, r)
45 }