Reverse proxies (SSL), traffic through Stunnel for many node.js applications

I am looking for some ideas ...

I have a number of reliable node.js applications that need to be delivered to specific users (after authentication), almost without files, only initial index delivery. The rest of the message is done through socket.io.

  • ClientA (login) must be connected to the application, say: 90001
  • Client (login): 90002
  • ClientC (login) on: 90003

* All HTTP / 1.1 ws must be protected

I tried several configurations:

  • Stunnel / Varnish / Nginx
  • Stunnel / haproxy
  • Stunnel / nginx

I thought a good approach would be to somehow use redis to store sessions and check for cookies, however this will most likely be done using node) displaying node.js on the interface.

questions:

What are the risks when using node-http-proxy as the front end?

This is what I should consider possible (to have one part that reliably redirects ws traffic and manages certain sessions for many independent / exclusive backends).

I know that nginx 1.3 (in dev) should support ws, is it worth it to stand for?

Does anyone have any experience with the yao tcp_proxy module for nginx (reliability / scalability)?

+4
source share
1 answer

I cannot say that I have done this before, but I can offer some ideas, perhaps:

1 node authentication server that accepts login information and sets a cookie specific to the server the user should connect to. Then it is redirected to the index page, at this point, haproxy can send a request based on the cookie. See this question https://serverfault.com/questions/75385/is-there-a-way-to-configure-haproxy-to-send-traffic-based-on-a-cookie

Alternatively, you could use the above authentication on all servers, and not on one. Haproxy should be configured to balance all nodes if there is no corresponding cookie header. Each node will perform a set-cookie + redirect, and subsequent requests should end on a particular instance of node.

bts, haproxy 1.5 dev now has built-in SSL support, so stunnel is no longer required.

0
source

Source: https://habr.com/ru/post/1443025/


All Articles