Nginx – Load balance https and websockets wth sticky sessions and NGINX

load balancingnginxsocketsslsticky-sessions

I'm using NGINX to do sticky session load balancing in front of a node.js app that will support http, ssl, and websockets. If I want the load balancer to simply forward requests to the node.js server and always have the node.js server handle any SSL termination, will it still be possible to use sticky sessions based on cookies or IP address? Or will I need to do SSL termination at the load balancer level?

If I need to do SSL termination at the L.B. level, then do I need to re-encrypt the request before sending the request off to the node.js server?

Best Answer

If you want the server to handle SSL termination you could use:

  • the SSL-ID to do the load balancing but is has limitations as metioned here
  • the client IP but have impact ofe.g. large proxies

If you would want to circumvent these problems you can terminate the SSL session on the LB and use cookies for stickyness. Unless some limitation with the application (eg hard-coded links) there is no need to re-encrypt.

Related Topic