Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
Connect to MongoDB using mongoose with proxy

Goal : Connect to a public facing mongodb instance in my local development environment, which is connected to my corporate network.

Background : There is a proxy available for bypassing this corporate firewall. I am developing a Next JS application with mongo as the backend.

Ask : How do I use this proxy to connect to the mongo instance in my node js application?

 const db = await mongoose
      .connect(process.env.NEXT_PUBLIC_MONGO_URI, {
        dbName: "cusum",
        useCreateIndex: true,
        useFindAndModify: false,
        useNewUrlParser: true,
        useUnifiedTopology: true,
      })
      .catch((err) => console.log(err.reason));

This is how I connect to my mongo db instance using mongoose, in my node js application. It works when not connected to my corporate network, but times out when connected to my corporate network.

I was able to connect to the instance using Studio 3T with its built in proxy support, however this is just a GUI client for mongo db.

Attempts

I have attempted to use the global-tunnel package to route all http connections to the proxy but it didn't work.

globalTunnel.initialize({
  host: "proxy-xx.xxx.com",
  port: 8080,
  protocol: "http:",
  connect: "both",
});
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I hope this link can help on a corporate proxy issue

Connect to MongoDB database using mongoose behind a proxy

Also, you can look into Nginx as a proxy, depending on your company configuration, though I see you're working wit Nextjs, most of it will depend on the configuration used at your company

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda