-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to rewrite or customize the default 404 response? #3192
Comments
Update: https://getkong.org/docs/0.12.x/proxy/#configuring-a-fallback-api You can use a combination of a root-fallback and the request termination plugin: Fallback API
Termination Plugin responds with 404 and html w/ javascript to redirect.
|
@Maples7, please close this issue if @dustinschultz's answer gave you an inspiration. If not, please let us know the issues of that aproach, thank you! |
@dustinschultz Thank you very much for your solution. But after I follow your instruction, API doesn't return 404 and the request hits my custom plugins. I feel a little confused. Sorry for reply so late due to Lunar New Year. |
And I'd like to know that "_" and "-1" are wildcards? |
I have figured out why the requests would hit my custom plugins which have higher priority. So the question goes to how can I make plugin |
I've read the source code of plugin |
I solve the problem finally by adding code logic of 404 response in my own custom plugin and it works well. Thank U all guys 4 providing this method! :D |
|
this plugin all the request 404 no matter which kind of response code is sent by backend server. |
When a user requests a non-existent API, kong will return 404 with
Is there any way to rewrite the response body or customize 404 response? 🤔
The text was updated successfully, but these errors were encountered: