How to make net.connect() requests via socks5 (or other) proxy? - node.js

From my understanding net.connect(port[, host][, connectListener]) or socket.connect(port[, host][, connectListener]) doesn't support proxy configuration. What would be the in app solution to use socks5 or ther proxy servers for net.connect/socket.connect?

Related

Tor proxy socks5

How to put a proxy server with authorization on the output, according to the documentation
The end still shows TOR, not a proxy
/etc/torrc
`Socks5Proxy
Socks5ProxyUsername
Socks5ProxyPassword
`
You should probably edit /etc/torrc.conf or /etc/tor/torrc.conf config
I found this for you :
HTTPProxy host[:port]
Tor will make all its directory requests through this host:port (or
host:80 if port is not specified), rather than connecting directly to
any directory servers.
HTTPProxyAuthenticator username:password
If defined, Tor will use this username:password for Basic HTTP proxy
authentication, as in RFC 2617. This is currently the only form of
HTTP proxy authentication that Tor supports; feel free to submit a
patch if you want it to support others.
HTTPSProxy host[:port]
Tor will make all its OR (SSL) connections through this host:port (or
host:443 if port is not specified), via HTTP CONNECT rather than
connecting directly to servers. You may want to set FascistFirewall to
restrict the set of ports you might try to connect to, if your HTTPS
proxy only allows connecting to certain ports.
HTTPSProxyAuthenticator username:password
If defined, Tor will use this username:password for Basic HTTPS proxy
authentication, as in RFC 2617. This is currently the only form of
HTTPS proxy authentication that Tor supports; feel free to submit a
patch if you want it to support others.
Socks4Proxy host[:port]
Tor will make all OR connections through the SOCKS 4 proxy at
host:port (or host:1080 if port is not specified).
Socks5Proxy host[:port]
Tor will make all OR connections through the SOCKS 5 proxy at
host:port (or host:1080 if port is not specified).
Socks5ProxyUsername username
Socks5ProxyPassword password
If defined, authenticate to the SOCKS 5 server using username and
password in accordance to RFC 1929. Both username and password must be
between 1 and 255 characters.

Does only my web server proxy need to support HTTP 2/3

I run an ExpressJS website in a docker container forwarded to a localhost port. I use NGINX to proxy and push it to the internet with caching, SSL, and all of the normal things.
I am wondering how I need to implement HTTP 2 and 3. Similar to SSL, do I only need to use it on my proxy server (NGINX), or does the whole chain need to support it?

Proxy all sentry request in node application

I have a nodeJs application which I want to use sentry in my application. I configured it properly but I want to proxy all my sentry requests. so how can I do this? can I do something like port forwarding, for example, all requests to https://XXXXX#sentry.io go through the specific machine in another host then redirect to sentry.io? how can I do that?
You can configure an HTTP(S) Proxy.
The docs on sentry.io say:
httpProxy
When set a proxy can be configured that should be used for outbound requests. This is also used for HTTPS requests unless a separate https-proxy is configured. Note however that not all SDKs support a separate HTTPS proxy. SDKs will attempt to default to the system-wide configured proxy if possible. For instance, on unix systems, the http_proxy environment variable will be picked up.
There's a dedicated option for https too, if you want different proxies.

Firewall - proxy setting for connecting HazelCast server host:port

Is there way to set Proxy settings (route via proxy Server) for HazelcastClient to connect to remote cache server (which is behind a firwall)
Thanks
No since Hazelcast clients use an internally developed (even though open source), plain TCP protocol, there is no real proxy support. You might be able to use a SOCKS proxy though but this is not supported.
There's also a prototype to tunnel the protocol through a HTTPS session but same thing, not officially supported: https://github.com/noctarius/https-tunnel-openshift-hazelcast

Do I really need proxy for handling node.js?

I'm going to use Socket.IO to handle websockets or XHR-polling to implement a realtime app
which is on the top of node.js.
Many people are so into proxying their node.js server and
I don't understand the true meaning of proxy except security reasons.
Is there other reason to set proxy to handle node?
I'm currently using nginx 1.1 as a webserver and proxy server.
Unfortunately, I have found that nginx 1.1 can support HTTP 1.1 but not websockets.
Should I just use Socket.IO without proxying?
Or If I really need to do it so, how can I set up proxying websockets with nginx or other alternatives?
You may have noticed that you can only run one server on any given TCP port. If you want to use node.js and any other web server, then you'll want to have a proxy server to send client requests to the correct backend server.

Resources