mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 20:16:37 +00:00
Watchdog - enable forwarding of HTTP headers via CGI-like env vars.
This commit is contained in:
@ -51,6 +51,16 @@ func pipeRequest(config *WatchdogConfig, w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
targetCmd := exec.Command(parts[0], parts[1:]...)
|
||||
|
||||
if config.cgiHeaders {
|
||||
envs := os.Environ()
|
||||
for k, v := range r.Header {
|
||||
kv := fmt.Sprintf("Http_%s=%s", k, v[0])
|
||||
envs = append(envs, kv)
|
||||
}
|
||||
targetCmd.Env = envs
|
||||
}
|
||||
|
||||
writer, _ := targetCmd.StdinPipe()
|
||||
|
||||
var out []byte
|
||||
|
Reference in New Issue
Block a user