Connect to MongoDB database using mongoose behind a proxy
Asked Answered
C

1

10

I am using mongoose to connect to my database in mongolab in my server.js file :

mongoose.connect('mongodb://MyUsername:[email protected]:89702/todo'); 

When i launch my server with node server.js command, i see this error in my terminal

failed to connect to [ds089702.mongolab.com:89702]

I am very sure that is just a corporate proxy problem, so I'm wondering how can I connect to my database over the corporate proxy using mongoose ?

Thank you!

Cologarithm answered 2/11, 2015 at 17:11 Comment(3)
Did you ever find a solution to your problem ?Dehydrogenase
Hello @Dehydrogenase Sadly, No :/Cologarithm
No solution yet ??Iliac
H
1

I had the same problem and figured out a solution that worked for me.

Example mongodb URI:

mongodb://:@ds123456.mlab.com:37409/dbName

  1. Use a proxy client (e.g. Proxifier).
  2. Create a HTTPS proxy through port 8080 using your corporate proxy as the address.

enter image description here

  1. Create a rule for mlab using your URI's port as the target port, which uses the HTTPS proxy you created above as its action.

enter image description here

  1. Prioritize your mlab rule high in the rules list.

enter image description here

Handsomely answered 6/4, 2018 at 18:59 Comment(2)
any free version for mac?Aligarh
@RishabhDeepSingh proxifier has a free trial period. You might be able to find a free alternative.Handsomely

© 2022 - 2024 — McMap. All rights reserved.