How to do mqtt proxy settings in node? - node.js

Where do we do the proxy settings for the node mqtt package?
I have a system ready, that needs to get through a SOCKS5 proxy. But where do i do the settings for it?
I was not able to find anything regarding that on the github repo of the package.

I would guess that you don't actually in the nodejs code.
Have you tried using the socksify application to wrap your nodejs application?
socksify man page

Related

node neo4j-driver dosen't allow proxy setting when neo4j-desktop does

I would like to connect to neo4j instance hosted in aws through my node server running in local. I can connect to it using neo4j desktop using proxy settings. I couldent find similar settings in driver though...
Am i missing something?
Tried setting proxy at system level, bash level using export/set nothing works....
Tried using library 'global-tunnel' but this only supports 'request' library and I guess relies on http and https. I am using bolt and that seems to be problem...

Proxy module doesn't work when serving nuxt app statically

So, Iv'e been trying to setup a small example of a server with 2 factor authentication features. I'm using nuxt as the frontend and flask as the backend.
While developing locally (using npm run dev) I was able to get the chain of communication to work:
The webpage sends a request to server/<some_request>/<some_param>
The proxy module redirects it to http://localhost:5000/<some_request>/<some_param>
The request is sent by the axios module
flask receives the request, processes it and answers.
When trying to deploy this application to a dreamhost server, I used npm run build and npm run generate to serve the website statically. I was able to receive my webpage when browsing.
But when trying to login, the chain described above broke, and requests to server/<some_request>/<some_param> were answered with 404. In the server's command line I saw that flask didn't receive any request, so I assume that this is some issue with the proxy module.
I'm not really sure how to debug this problem, so any help or ideas will be appreciated.
Okay, so I got everything working, and here are my conclusions:
The proxy module, makes the redirection in the client side, meaning that I would be trying to access my own machine when redirecting to localhost:5000, rather than to the server.
The proxy module can't be used when using npm run generate (there's a warning that says it's disabled).
Since I wanted to redirect to flask from the client side (browser), I couldn't just run it as is. I had to register another subdomain and use Passenger to deploy my app (A guide to enabling passenger, getting started with python in passenger and A great guide to deploying flask over passenger).

client not connecting to node js server on AWS with WSS/WS protocols

I created a small server using socket.io and node js and deployed in heroku earlier. I was easily able to have client connected to server with wss/ws protocol but when I deployed my app too AWS, Clients are not connecting. I debugged the application in client side but Its just not connecting to server. Did I miss something? are there extra steps needs to followed to make it work?
Thanks.
Answering my own question, I had to add .ebextensions folder with a config in my project root directory. You can look at the following tutorial to make it work https://nikhilmopidevi.github.io/2017/10/18/WebSockets-with-AWS-Elastic-Beanstalk/

GRPC from client to server with forward proxy in node.js

I' trying to make a gRPC connection behind a proxy on the internet from a node.js app.
I can't find documentation that describes how to configure the gRPC module to use a forward proxy.
When running gRPC, you can specify an http_proxy environment variable.
See
https://github.com/grpc/grpc/blob/master/doc/environment_variables.md

Where to terminate SSL/TLS in Node & Nginx

I'm building a web application using the MEAN stack. The site contains authentication (using passport.js) so I would like to secure our connection with SSL/TLS.
For our deployment we're using nginx as a reverse proxy to the Node app running on the same AWS EC2 instance.
My question is: With my setup, what is the best practice way to setup an https (SSL/TLS) connection? Should I get a certificate and set it up at the nginx layer? Should I do it in my node app directly? Is there some other better way?
I've done some googling but haven't found anything profound. If anyone could point me to an article on the topic that would be very useful as well.
Thanks in advance!
First it's good to have SSL running on NGINX. So the communication is encrypted for the visitor in the first place (at least to the NGINX). If you're running Node on the same instance it's probably not absolutely necessary to encrypt also the traffic between Node and NGINX. But as soon as you have NGINX on another place running you should use SSL on Node too. As the data could potentially be accessed by Hackers.

Resources