Skip to content

Commit

Permalink
feat(http): ability to easily override host header to http(s) proxy t…
Browse files Browse the repository at this point in the history
…arget
  • Loading branch information
mefellows committed Mar 7, 2017
1 parent 9326a1d commit 9d0bf17
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions symptom/http_tamperer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type RequestConfig struct {
Cookies []http.Cookie
Body string
Path string
Host string
}

// ResponseConfig contains details of the HTTP response to tamper with prior to
Expand Down Expand Up @@ -96,6 +97,12 @@ func (m *HTTPTampererSymptom) MuckRequest(ctx *muxy.Context) {
ctx.Request.URL.Path = m.Request.Path
}

// Host
if m.Request.Host != "" {
log.Debug("HTTP Tamperer Spoofing HTTP Host from [%s] to [%s]", ctx.Request.URL.Host, log.Colorize(log.BLUE, m.Request.Host))
ctx.Request.Host = m.Request.Host
}

// Body
if m.Request.Body != "" {
newreq, err := http.NewRequest(ctx.Request.Method, ctx.Request.URL.String(), bytes.NewBuffer([]byte(m.Request.Body)))
Expand Down

0 comments on commit 9d0bf17

Please sign in to comment.