-
Notifications
You must be signed in to change notification settings - Fork 717
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
Websockets add path for proxy #859
Comments
@bfoxstudio Again, since URLs that are discovered will not have the path, I wonder if this should be an option and then added to the http's URL (unless of course the provided URL has already a path, then use that one instead). What do you think? |
I had the same problem! I fix this problem by: // For http request, we need the passed URL to contain either http or https scheme.
scheme := "http"
if tlsRequired {
scheme = "https"
}
ustr := fmt.Sprintf("%s://%s", scheme, u.Host)
u, err = url.Parse(ustr)
if err != nil {
return err
} change to // For http request, we need the passed URL to contain either http or https scheme.
u.Scheme = "http"
if tlsRequired {
u.Scheme = "https"
} |
@bfoxstudio I deplpy nats-server behind the nginx; nginx will route request to nats-server by the url path.
|
We encountered the same issue and I think there are a few lines of codes missing in the solution. This is the minor change I ended up doing to include the url path:
|
@shlomi-wexler-apolicy The fix on initial connect here is one thing, but as I posted earlier, what about the case of discovered URLs from the server, which are bare host:port. So I wonder if instead it should not be an option that is then added any time a websocket connection is attempted. |
@kozlovic looking at the code every websocket connection which is opened eventually goes through the wsInitHandshake function. In my proposed change above if its a bare url with only host:port the ustr variable will contain only that since the Path is empty. Am I missing something? |
@shlomi-wexler-apolicy Suppose that you provide the initial connect URL as |
Addressed by #974 |
client connect from Inernet o wss://host.com:port1/proxy_nginx_path
nginx redirect to ws://host_locla_company_network:port2/proxy_path
I made a mistake. we need fix nats.go client library
https://github.com/nats-io/nats.go/blob/main/ws.go#L563
ustr += u.Path
...
The text was updated successfully, but these errors were encountered: