TheKitsuneWithATie TheKitsuneWithATie - 1 year ago 62
HTTP Question

Which HTTP response code to send on unhandled request

I have a PHP application that has a router that should have two default handlers for

401 Unauthorized
404 Not Found

But it could happen that no handlers were set for those two cases. In that case, I need to have a default response that tells
Request Unhandled
, I have set it to the response code
400 Bad Request
, but I feel like its not truly appropriate.

What response code should I use for a unhandled request?

Answer Source

4xx is generally a client's problem. 5xx is your (server-side) problem. So if you cannot handle a request - it is HTTP 5xx.

In this case it looks that 501 Not Implemented is the best fit.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download