1

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.

2
  • isn't that should be client-side error? starting from 4xx? Commented Dec 5, 2016 at 13:45
  • right, I am quite new to http programming, I just figured out Commented Dec 5, 2016 at 13:48

2 Answers 2

2

I would use 404 status code:

404 Not Found:

  • The requested resource could not be found but may be available in the future.

But I am not sure, this is what you whant.

Sign up to request clarification or add additional context in comments.

1 Comment

While checking it out, I found that 421 should not be used by proxy servers (RFC 7540). :D
0

Use HTTP Code 0 Unreachable

Make sense since there is nothing to retrieve

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.