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

577
Visualizações
nginx: how to get the actual client ip?

I have a simple express app. which is Dockerized. This is Repository.

I used nginx as a reverse proxy there. when I visit http://45.33.97.232:3000, it gives me the actual IP. But, when I visit http://45.33.97.232/, It gives me the same server IP. But I need actual Client IP here. And I am using Server IP in nginx config file. but I have a restriction, I can't write Server IP in nginx config file.

This is my nginx config file,

server {
    listen 80 default_server;
    server_name 45.33.97.232;
location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://45.33.97.232:3000; #port where you are serving your express app.
  }
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In nginx if you want to pass through the IP address of the remote user to your backend web server you have to set X-Forwarded-For header to this remote ip, Like this:

proxy_set_header X-Forwarded-For $remote_addr;

and if you do not want to use server IP you can use the domain in your Nginx config file.

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