Reputation: 7581
Maybe this is an opinion based question, maybe not, I am not sure so I'll ask.
I am implementing a simple proxy server. Which is the most appropriate error code for the proxy to return when a url that does not resolve to anything is requested?
After some search I came to the understanding that there is not a standard http code for this occasion, maybe this is due to the fact that for a server it's hard to determine what is the cause of not being able to resolve a url.
The closest to meaningful status codes I have found are the
502
The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.and
504
The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.but in my understanding both imply that the url was found in the dns.
Upvotes: 1
Views: 3882
Reputation: 906
Use HTTP Code 0 Unreachable
Make sense since there is nothing to retrieve
Upvotes: 0
Reputation: 1996
I would use 404 status code:
404 Not Found:
But I am not sure, this is what you whant.
Upvotes: 2