-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Status code on unresolvable hosts. #51
Comments
Actually squid responds with 503 status code:
|
I apologize for not getting back to you until now. I'm really not sure what should be the correct response. Can you help me by specifying the use case? How do you use this information (or is it that you just want to be squid-compliant). |
I just want to somehow detect this situation and show to a user some custom more or less nice looking error page and intercepting 500 "Internal Server Error" seems to me not a very good idea. I think that squid's behavior is more logical in this case. |
+1 On this one. Some of my users are running their own servers (say on localhost:3000), and it'd be great if goproxy could make it easy to distinguish between a server that's not running (ie the user forgot to start it) and a server that responded with a 500. |
I'm convinced. Would fix tonight. On Thu, Dec 4, 2014, 5:39 PM Marc MacLeod notifications@github.com wrote:
|
Any update on that? |
Currently, it's not possible to distinguish target server internal error from using a wrong server or server being down. This patch changes status code 500 to 502 in case we cannot get a response from upstream. Below snippets from the HTTP specification: > The HyperText Transfer Protocol (HTTP) 502 Bad Gateway > server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502 vs. > The HyperText Transfer Protocol (HTTP) 500 Internal Server Error > server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. > This error response is a generic "catch-all" response. Usually, this indicates the server cannot find a better 5xx error code to response. Sometimes, server administrators log error responses like the 500 status code with more details about the request to prevent the error from happening again in the future. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 Fixes elazarl#51
This patch allows to distinguish between status codes * 502 - network error, failed to dial * 504 - network error, dial timeout * 500 - other error Relates to elazarl#51
Currently, it's not possible to distinguish target server internal error from using a wrong server or server being down. This patch changes status code 500 to 502 in case we cannot get a response from upstream. Below snippets from the HTTP specification: > The HyperText Transfer Protocol (HTTP) 502 Bad Gateway > server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502 vs. > The HyperText Transfer Protocol (HTTP) 500 Internal Server Error > server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. > This error response is a generic "catch-all" response. Usually, this indicates the server cannot find a better 5xx error code to response. Sometimes, server administrators log error responses like the 500 status code with more details about the request to prevent the error from happening again in the future. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 Fixes elazarl#51
This patch allows to distinguish between status codes * 502 - network error, failed to dial * 504 - network error, dial timeout * 500 - other error Relates to elazarl#51
@elazarl Is there any progress on this issue, or was it somehow addressed in a different way? Right now I do the following to handle this:
|
If we try to access through goproxy host which doesn't have DNS record goproxy returns 500 (Internal Server Error) HTTP status code, while squid-cache returns 502 (Bad Gateway) HTTP status code. Shouldn't goproxy simulate squid's behavior?
The text was updated successfully, but these errors were encountered: