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

327
Visualizações
Is there a way to pass the correct remote address to Nginx in a Docker container

I have a Nginx webserver that I'm running from inside a docker container. The problem I am having is that all client IP addresses in the nginx access.log are 172.19.0.1, the container's gateway. I would like the IP addresses shown to nginx to be the real IP addresses of the clients.

I've tried a few solutions that I found, including

  1. Using Nginx's realip module
    set_real_ip_from 172.19.0.1;
    real_ip_header X-Real-IP;
    real_ip_recursive on;

which still logged the gateway ip

  1. Setting the ports to host networking mode, which was ineffectual because I'm on macOS, and it is only supported on Linux.

The dockerfile I'm using looks like this

version: "3"
services:
    nginx:
        container_name: nginx
        ports:
            - target: 80
              published: 80
            - target: 443
              published: 443
        volumes:
            # [my volumes]
        restart: unless-stopped
        image: nginx
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