Skip to content

Commit

Permalink
Modify to uppercase for X-OpenFaaS-Internal
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Aug 8, 2023
1 parent 841fe51 commit b832d4d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient
pathVars := mux.Vars(originalReq)
functionName := pathVars["name"]
if functionName == "" {
w.Header().Add("x-openfaas-internal", "proxy")
w.Header().Add("X-OpenFaaS-Internal", "proxy")

httputil.Errorf(w, http.StatusBadRequest, "Provide function name in the request path")
return
}

functionAddr, err := resolver.Resolve(functionName)
if err != nil {
w.Header().Add("x-openfaas-internal", "proxy")
w.Header().Add("X-OpenFaaS-Internal", "proxy")

// TODO: Should record the 404/not found error in Prometheus.
log.Printf("resolver error: no endpoints for %s: %s\n", functionName, err.Error())
Expand All @@ -156,7 +156,7 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient
proxyReq, err := buildProxyRequest(originalReq, functionAddr, pathVars["params"])
if err != nil {

w.Header().Add("x-openfaas-internal", "proxy")
w.Header().Add("X-OpenFaaS-Internal", "proxy")

httputil.Errorf(w, http.StatusInternalServerError, "Failed to resolve service: %s.", functionName)
return
Expand All @@ -173,7 +173,7 @@ func proxyRequest(w http.ResponseWriter, originalReq *http.Request, proxyClient
if err != nil {
log.Printf("error with proxy request to: %s, %s\n", proxyReq.URL.String(), err.Error())

w.Header().Add("x-openfaas-internal", "proxy")
w.Header().Add("X-OpenFaaS-Internal", "proxy")

httputil.Errorf(w, http.StatusInternalServerError, "Can't reach service for: %s.", functionName)
return
Expand Down

0 comments on commit b832d4d

Please sign in to comment.