How does http go client handles StatusProxyAuthRequired(407) response code

Currently I have an application that has a client(cli) and server(java). The client communicates with the server and the server return a response.
My question is, what happens when a Proxy stands between the client and the server?
Also, how http go client handles StatusProxyAuthRequired(407) which is a status code from the proxy? Is it packing a new authentication request which contains username and password automatically or do nothing?

Thank you!

Are you asking something specific to OGS?

First, if you are looking for a general solution, Stack Overflow might be a better site for this question. I found many questions using the search “http status 407” (link). While they might not address your specific issue, they might help with refining the search needed to find the information you need.

It is quite possible that OGS is not handling this at all. Usually, this is handled by the browser and the site-specific code never sees that status. For OGS, the initial connection through the proxy is initiated by the browser opening a specific URL. If there is a proxy and that proxy requires authentication, the proxy will return the 407 and the browser will prompt for the needed credentials (or use a cached value). After that, the browser connects through the proxy to OGS and all proceeds as normal.

If you are using a custom client, you need to provide a method to acquire the needed authentication. This could be a prompt on stderr (my preference though stdout could also be used) and reading the response from stdin. You could also create command line option(s) to allow the user to specify the needed tokens to traverse the proxy and exit with a message like “Proxy Authentication Needed” if you get a 407 and no authentication was provided.

1 Like

I have the same problem, but with one strange feature. Previously, when working with proxies in a similar situation, all was well. Recently switched to new plan from another provider (advanced.name/ru if it matters), then I had a problem. How can there be involved in the provider?

Again, this does not seem related to OGS, and is rather a generic programming question. You should direct this to StackOverflow instead.

2 Likes

Thank you!!