Skip to content

Commit

Permalink
Added KeepHeader #306:
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Wieland authored and elazarl committed Jul 10, 2020
1 parent 49ad98f commit 96f1a10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/elazarl/goproxy

go 1.14

require github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2
5 changes: 4 additions & 1 deletion proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type ProxyHttpServer struct {
// if nil Tr.Dial will be used
ConnectDial func(network string, addr string) (net.Conn, error)
CertStore CertStorage
KeepHeader bool
}

var hasPort = regexp.MustCompile(`:\d+$`)
Expand Down Expand Up @@ -118,7 +119,9 @@ func (proxy *ProxyHttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
proxy.serveWebsocket(ctx, w, r)
}

removeProxyHeaders(ctx, r)
if !proxy.KeepHeader {
removeProxyHeaders(ctx, r)
}
resp, err = ctx.RoundTrip(r)
if err != nil {
ctx.Error = err
Expand Down

0 comments on commit 96f1a10

Please sign in to comment.