Proxy all sentry request in node application - node.js

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.

Related

Make all http requests in Node follow machine's proxy settings

I am investigating some background Http requests made by a third party module. I want to route all such requests (I don't know where they are located) through a proxy (Fiddler) configured at the PC level so that I can inspect the payload and responses.
Is there a way to transparently make all network requests in a Node app follow the PC's proxy settings?

which to prefer http vs https in nodejs

Recently i learned about https module in nodejs,
Like How to use it and generating certificate and key for it.
But there is also http module which most of the tutor teaches at beginning.
But the main question is,
when i create back-end server with http module.
and hosted on website like heroku after deploying we get by default https protocol for our website and its secure.
and even same for using https module
so what's the difference/advantage we get by using http/https module on one over another protocol?
does it make difference?
and which module to prefer while writing server code?
When you are running in a hosting environment like heroku that puts you behind a proxy and that proxy handles the https to the outside world for you, then that's all you need. There is no need to use https on your server directly between you and the proxy as it already has https to the outside world via the proxy and you don't need https between your server and the proxy as that's local to the secure network of the hosting facility.
If you are not running behind such a proxy, then you will want your own server to be https.
In order to ensure secure communication with users of your Express.js applications, you can make all traffic to use HTTPS, by forcing a redirect from HTTP.

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?

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

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?

Can Host Headers resolved to a virtual host node.js like in Apache?

Host headers cause a webserver to return a different virtual host based on which DNS name the DNS server resolved to send the browser to the servers ip. Is it possible to build this sort of functionality into a node.js http server between multiple deployed apps?
(Of course you could just use Apache to do this, but can it be done without Apache?)
Yes, you can certainly implement this same behavior in node. The http module only provides a basic server instance with a request callback, but you can expand on that by checking the Host header and then routing the request to the proper application.
If you are using an server framework like express or connect, there is a vhost middleware that will provide this functionality.

Resources