diff --git a/gateway/handlers/callid_middleware.go b/gateway/handlers/callid_middleware.go index a1ddea54f..61a27259b 100644 --- a/gateway/handlers/callid_middleware.go +++ b/gateway/handlers/callid_middleware.go @@ -9,10 +9,14 @@ import ( "time" "github.com/docker/distribution/uuid" + "github.com/openfaas/faas/gateway/version" ) // MakeCallIDMiddleware middleware tags a request with a uid func MakeCallIDMiddleware(next http.HandlerFunc) http.HandlerFunc { + + version := version.Version + return func(w http.ResponseWriter, r *http.Request) { start := time.Now() if len(r.Header.Get("X-Call-Id")) == 0 { @@ -24,6 +28,8 @@ func MakeCallIDMiddleware(next http.HandlerFunc) http.HandlerFunc { r.Header.Add("X-Start-Time", fmt.Sprintf("%d", start.UTC().UnixNano())) w.Header().Add("X-Start-Time", fmt.Sprintf("%d", start.UTC().UnixNano())) + w.Header().Add("X-Served-By", fmt.Sprintf("openfaas-community/%s", version)) + next(w, r) } }