I have seen both the Response Transformer Plugin and the Advanced Response Transformer Plugin that will allow you to change, for example, the body of a particular response, for example by setting the declarative way:
config.replace.body='{\"error\": \"internal server error\"}'"
How could I change the status code of a response, for example if I wanted to always return 200 even when other plugins such as the rate limiter one intercept the request?
Is there another plugin that may support this functionality? Or should I write a custom plugin?
A possible way is to use the serverless-function plugin: https://docs.konghq.com/hub/kong-inc/serverless-functions/ in particular the post-function
plugin.
This plugin allows you to apply a custom lua function, runned after the other plugins, e.g. to the kong response. To change the status code you could use something like:
return function()
kong.response.set_status(200)
end
and apply this snippet of code to the header_filter
phase (a parameter of the plugin conf.).
Another possibility is to use the exit-plugin
https://docs.konghq.com/hub/kong-inc/exit-transformer/ to change the Kong's response.