mirror of
https://github.com/openfaas/faas.git
synced 2025-06-19 12:36:40 +00:00
Propagate Host header from gateway request to the function.
Host HTTP header was not propagated to the function because it is not a part of http.Request.Header map. Signed-off-by: Dmitri Rubinstein <dmitri.rubinstein@googlemail.com>
This commit is contained in:
committed by
Alex Ellis
parent
c86de503c7
commit
fd0abe46dd
@ -53,6 +53,9 @@ func buildUpstreamRequest(r *http.Request, url string) *http.Request {
|
||||
}
|
||||
|
||||
upstreamReq, _ := http.NewRequest(r.Method, url, nil)
|
||||
if len(r.Host) > 0 {
|
||||
upstreamReq.Host = r.Host
|
||||
}
|
||||
copyHeaders(upstreamReq.Header, &r.Header)
|
||||
|
||||
upstreamReq.Header["X-Forwarded-For"] = []string{r.RemoteAddr}
|
||||
|
Reference in New Issue
Block a user