dimitris fou
dimitris fou

Reputation: 29

Custom Plugin in Go for KrakenD

Know anyone which function i have to use in Go for my plugin to inject a custom header for each incoming request to Gateway Krakend ????

Thanks !!!

i have create a plugin with this function to inject a custom header into for each incoming request in krakenD but it didn't work!!! :

return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request){
                   .
                   .
     w.Header().Add("Content-Type", "application/json")
}

Upvotes: 1

Views: 711

Answers (1)

Yannis
Yannis

Reputation: 23

According to your code, you are trying to add a header to the response (w), not the request.

KrakenD (actually lura) by default ignores the response headers when a response encoding is used (i.e. anything other than no-op). So I am afraid it is not possible to add a custom header to the response.

See https://github.com/luraproject/lura/issues/311

Upvotes: 1

Related Questions