Connecting to MongoDB Atlas cluster using nginx proxy

Hi all,

I’m trying to connect a Node.js client app to a MongoDB Atlas shared cluster, but I’m facing issues due to firewall restrictions on the client machine. To work around this, I’m using a VPN-connected machine (which has unrestricted internet access) to run an Nginx proxy. The idea is to route the client traffic through Nginx to MongoDB Atlas.

However, I’m encountering SSL errors and can’t seem to establish a successful connection. I’ve configured Nginx for SSL passthrough, but there may be something I’m missing. Does anyone have a step-by-step guide or configuration examples for setting up Nginx as a reverse proxy for MongoDB Atlas with SSL passthrough? I am currently testing the nginx server using mongosh and it is failing MongoServerSelectionError: 40680D4A907D0000:error:0A000438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:…/deps/openssl/openssl/ssl/record/rec_layer_s3.c:1590:SSL alert number 80, MongoServerSelectionError: connection to : closed