You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KrakenD Version: 2.5.0
Go Version: 1.20.11
Glibc Version: MUSL-1.2.4_(alpine-3.18.4)
System info:
Docker version 23.0.1, build a5ee5b1
Hardware specs: 2 CPUs and 8GB of RAM allocated for the container
Backend technology: NodeJS
Additional environment information:
Describe what are you trying to do:
Trying to return error responses with header Content-Type: application/json without using output_encoding: 'no-op', backend error is returned with correct status and correct message but the response header Content-Type is always text/plain
Configuration check output:
Result of krakend check -dtc krakend.json --lint command
0 async agent(s):
Syntax OK!
Commands used:
How did you start the software?
krakend run -d -c krakend.json
Logs:
er/login"
newbackwithkrakend-gateway-1 | [00] Error #01: {"statusCode":400,"message":"email or password is not correct","error":"Bad Request"}
Additional comments:
I know using no-op would forward all headers of backend to the client including the Content-Type but i would like not to use no-op but still get my errors as json response
The text was updated successfully, but these errors were encountered:
yamanaliesh92
changed the title
Error responses' Content-Type is always returned text/plain for the client
Error responses' Content-Type is always returned as text/plain for the client
Dec 9, 2023
Everything works fine but unless the endpoint is set as no-op the content-type header on the response when there is a non-2xx response status from the backend is completely ignored.
So Kraken, forwards the error message (JSON) from the backend to the client but then just serves it with a content-type of text/plain which causes issues with some clients.
I think return_error_code should either also forward the same header from the backend to the client or another parameter be made available on the config to achieve the same thing.
Environment info:
Describe what are you trying to do:
Your configuration file:
Configuration check output:
Result of
krakend check -dtc krakend.json --lint
commandCommands used:
How did you start the software?
krakend run -d -c krakend.json
Logs:
Additional comments:
The text was updated successfully, but these errors were encountered: