简体   繁体   中英

Connecting Nowjs hosted Node.js server to MongoDB Atlas DB

I'm playing around with Nowjs, GraphQL, and MongoDB on a side-project and I'm using MongoDB Atlas to create a remote database and Nowjs to deploy my server. Also, I'm using Mongoose to connect to the DB.

The problem is, MongoDB Atlas requires you to whitelist IPs to connect to the database and I couldn't find much info IPs used by Nowjs servers where my deployments are being hosted. Also, I must add that I'm not currently using any custom domain or alias, just the random generated ones.

Is there a way to get the Nowjs IP and have it fixed somehow? Or having a whitelist of domains instead of IPs?

The only solution I could find is allowing any IP to access the DB, but that seems like something insecure to do.

Apparently this is not possible as of Zeit Now v2, there isn't really a way to get a range of IPs or a static one.

The answer from a maintainer:

The IP addresses of Now deployments are too dynamic and for that reason we don't provide a list of them. Our recommendation when connecting to external services (eg. a database) is to use a strong password and SSL.

There is a few content about it that you can check here and here ,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM