Open chen-shmilovich-sysdig opened 1 year ago
I guess this would be for when using the websocket option?
@wallyqs yes, that's correct.
@wallyqs, @chen-shmilovich-sysdig
Could it be that this is the line where the web socket is set up https://github.com/nats-io/nats.go/blob/370bc4fc4cac2de8d5dbbddbb98739f9cb2d7f8b/ws.go#L610? I am currently facing the same problem that requests behind a proxy are not covered by the SystemProxy settings and would like to change this.
I would probably have to use a net/Transport instead of the req.Write and use it to get the corresponding readers/writers, right?
I tried adding nats option "CustomDailer" to connection initialization process, but it doesnt work:
dailer := proxy.FromEnvironment()
options := []nats.Option{
nats.SetCustomDialer(dailer)
}
nc.conn is an Dialer-Interface, so adding the proxy settings at the beginning seemed sensible to me.
We solved our problem by using a CustomDialer. In my opinion, this Issue can be closed, as it can be solved cleanly in another way?
Feature Request
Add support for the
HTTP_PROXY
,HTTPS_PROXY
andNO_PROXY
environment variables, same as the http package does: https://pkg.go.dev/net/http#ProxyFromEnvironment.Use Case:
Proposed Change:
Who Benefits From The Change(s)?
Anyone who wants to run a NATS client behind a proxy server.
Alternative Approaches
Allowing the user to set the proxy configuration via one or more options. (
nats.Option
)