How to modify default error message?

Hi folks, I am not very familiar with Kong and things about it. I just want to ask, if it is possible to modify error message “API not found with these values” which occurs during some invalid API call, and how difficult it is for someone who has knowledge and managing this? If it is possible, could you also post me some manual how to do it? Thank you in advance.

Hi jm191,

If you are referring to the message {“message”:“no Route matched with those values”}, you can use the response-transformer plugin to replace the message content, ref :Response Transformer plugin | Kong Docs.

You could also setup a ‘catch-all’ path (anything that doesn’t explicitly match something you defined) and set a standard 404 type message.

ref:
https://support.konghq.com/support/s/article/How-to-create-a-catch-all-route-for-unmatched-paths

Hi joedas, thank you for your reply.
E.g. valid url is example.com/api/somerequest. If I tried invalid url e.g. example.com/api/asdfdsffsd I get this error

 "request_path": "/api/asdfdsffsd",
    "message": "API not found with these values",

I would like to replace message “API not found with these values” with my custom message.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ