Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

366
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda