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

363
Vistas
How to configure Express' trust proxy when deploy to Elastic Beanstalk and Cloudflare DNS?

I have a node.js app that is deployed to Elastic Beanstalk (EB), which uses nginx as a reverse proxy. Nothing fancy there, just used EB with a Docker config. I then added my EB's location, e.g. **.elasticbeanstalk.com as a CNAME in Cloudflare, and enabled SSL.

In my app I set:

app.set("trust proxy", 2) // What is the right value here?
sessionCookie = {
  httpOnly: true,
  secure: true, 
  maxAge: 24 * 60 * 60 * 1000
}

I've experimented with all of the below and all of which do not work:

app.set("trust proxy", 1) // or 2,3,4
app.set("trust proxy", ["loopback", "linklocal", "uniquelocal"])
app.set("trust proxy", function(ip) { return true })
app.set("trust proxy", true)

Any suggestions? If secure is set to false, then it works, but I don't think it's wise to set secure to false?

over 4 years ago · Santiago Trujillo
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