[GH-ISSUE #3131] Having issues migrating functional nginx config into Nginx Proxy Manager #2123

Closed
opened 2026-02-26 07:34:07 +03:00 by kerem · 4 comments
Owner

Originally created by @miversen33 on GitHub (Aug 15, 2023).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3131

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • Yes
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug

I have the following location defined in an nginx.conf which functions exactly as expected

location /portainer/ {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-Ip $remote_addr;
    proxy_set_header X-Forwarded-For $remote_add_x_forwarded_for;
    proxy_pass https://hostname.domain:9443/;
}

I figured it would be as easy as adding a new proxy host in Nginx Proxy Manager, adding the /portainer/ location and setting the various proxy_header variables in the advanced section of the location. However, when I add literally any of the proxy_set_header lines above, the location throws a 400. I cannot see anything really "useful" in the container logs for nginx-proxy-manager.

Am I missing something?

Nginx Proxy Manager Version

v2.10.4

To Reproduce
Steps to reproduce the behavior:

  1. Create new proxy host
  2. Add a location
  3. Add proxy_set_header X-Real-IP $remote_addr; (for example) to the advanced section of the location
  4. Save the location
  5. Navigate a new tab to the location
  6. Observe 400

Expected behavior

I would expect the proxy_set_header values to be respected. Additionally, if there is a configuration error occurring, some form of notification seems like a plus

Screenshots

I can provide these if needed

Operating System

  • RHEL 8.8
  • Docker version 24.0.5, build ced0996

Additional context

Running under compose using the following docker compose script

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      - '5090-6000:5090-6000' # Snag up any other ports we might want to proxy to
    volumes:
      - /opt/docker/npm/:/data

The only thing any of the log files emits on save is

[warn] 141#141: could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size: 64; ignoring proxy_headers_hash_bucket_size

And on hitting the created endpoint, the following 2 things are logged (along with lots of repeated 500s of trying to get the favicon)

==> proxy-host-2_access.log <==
[15/Aug/2023:17:03:34 +0000] - 400 400 - GET http hostname.domain "/portainer/" [Client 10.0.139.109] [Length 25] [Gzip -] [Sent-to hostname.domain] "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0" "-"

==> fallback_error.log <==
2023/08/15 17:03:34 [warn] 1471#1471: 512 worker_connections are not enough, reusing connections
Originally created by @miversen33 on GitHub (Aug 15, 2023). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3131 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes - Are you sure you're not using someone else's docker image? - Yes - Have you searched for similar issues (both open and closed)? - Yes **Describe the bug** <!-- A clear and concise description of what the bug is. --> I have the following location defined in an `nginx.conf` which functions exactly as expected ```nginx location /portainer/ { proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_add_x_forwarded_for; proxy_pass https://hostname.domain:9443/; } ``` I figured it would be as easy as adding a new proxy host in Nginx Proxy Manager, adding the `/portainer/` location and setting the various proxy_header variables in the `advanced` section of the location. However, when I add literally any of the `proxy_set_header` lines above, the location throws a 400. I cannot see anything really "useful" in the container logs for nginx-proxy-manager. Am I missing something? **Nginx Proxy Manager Version** <!-- What version of Nginx Proxy Manager is reported on the login page? --> v2.10.4 **To Reproduce** Steps to reproduce the behavior: 1. Create new proxy host 2. Add a location 3. Add `proxy_set_header X-Real-IP $remote_addr;` (for example) to the advanced section of the location 4. Save the location 5. Navigate a new tab to the location 6. Observe 400 **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> I would expect the `proxy_set_header` values to be respected. Additionally, if there is a configuration error occurring, some form of notification seems like a plus **Screenshots** <!-- If applicable, add screenshots to help explain your problem. --> I can provide these if needed **Operating System** <!-- Please specify if using a Rpi, Mac, orchestration tool or any other setups that might affect the reproduction of this error. --> - RHEL 8.8 - Docker version 24.0.5, build ced0996 **Additional context** <!-- Add any other context about the problem here, docker version, browser version, logs if applicable to the problem. Too much info is better than too little. --> Running under compose using the following docker compose script ```yaml version: '3.8' services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: - '80:80' # Public HTTP Port - '443:443' # Public HTTPS Port - '81:81' # Admin Web Port - '5090-6000:5090-6000' # Snag up any other ports we might want to proxy to volumes: - /opt/docker/npm/:/data ``` The only thing any of the log files emits on save is > [warn] 141#141: could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size: 64; ignoring proxy_headers_hash_bucket_size And on hitting the created endpoint, the following 2 things are logged (along with lots of repeated 500s of trying to get the favicon) ``` ==> proxy-host-2_access.log <== [15/Aug/2023:17:03:34 +0000] - 400 400 - GET http hostname.domain "/portainer/" [Client 10.0.139.109] [Length 25] [Gzip -] [Sent-to hostname.domain] "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0" "-" ==> fallback_error.log <== 2023/08/15 17:03:34 [warn] 1471#1471: 512 worker_connections are not enough, reusing connections ```
kerem 2026-02-26 07:34:07 +03:00
  • closed this issue
  • added the
    stale
    bug
    labels
Author
Owner

@miversen33 commented on GitHub (Sep 1, 2023):

Is there more information that I need to provide to get some kind of feedback about what I may be doing incorrectly here?

<!-- gh-comment-id:1703143480 --> @miversen33 commented on GitHub (Sep 1, 2023): Is there more information that I need to provide to get some kind of feedback about what I may be doing incorrectly here?
Author
Owner

@edsonsbj commented on GitHub (Oct 9, 2023):

Lista

  • Você puxou e encontrou o erro com a imagem do docker? jc21/nginx-proxy-manager:latest
    • Sim
  • Tem certeza de que não está usando a imagem docker de outra pessoa?
    • Sim
  • Você já pesquisou por problemas semelhantes (abertos e fechados)?
    • Sim

Descreva o bug

Eu tenho o seguinte local definido em um que funciona exatamente como esperadonginx.conf

location /portainer/ {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-Ip $remote_addr;
    proxy_set_header X-Forwarded-For $remote_add_x_forwarded_for;
    proxy_pass https://hostname.domain:9443/;
}

Eu imaginei que seria tão fácil quanto adicionar um novo host proxy no Nginx Proxy Manager, adicionando o local e definindo as várias variáveis proxy_header na seção do local. No entanto, quando eu adiciono literalmente qualquer uma das linhas acima, o local lança um 400. Não consigo ver nada realmente "útil" nos logs de contêiner para nginx-proxy-manager./portainer/``advanced``proxy_set_header

Estou sentindo falta de alguma coisa?

Nginx Proxy Manager Versão

v2.10.4

Para reproduzir etapas para reproduzir o comportamento:

  1. Criar novo host proxy
  2. Adicionar uma localização
  3. Adicionar (por exemplo) à seção avançada do localproxy_set_header X-Real-IP $remote_addr;
  4. Salve o local
  5. Navegar em uma nova guia até o local
  6. Observe 400

Comportamento esperado

Espero que os valores sejam respeitados. Além disso, se houver um erro de configuração ocorrendo, alguma forma de notificação parece uma vantagemproxy_set_header

Imagens

Eu posso fornecê-los, se necessário

Sistema Operacional

  • RHEL 8,8
  • Docker versão 24.0.5, build ced0996

Contexto adicional

Executando sob composição usando o seguinte script de composição docker

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      - '5090-6000:5090-6000' # Snag up any other ports we might want to proxy to
    volumes:
      - /opt/docker/npm/:/data

A única coisa que qualquer um dos arquivos de log emite ao salvar é

[aviso] 141#141: não foi possível construir proxy_headers_hash ideal, você deve aumentar proxy_headers_hash_max_size: 512 ou proxy_headers_hash_bucket_size: 64; ignorando proxy_headers_hash_bucket_size

E ao atingir o ponto de extremidade criado, as 2 coisas a seguir são registradas (junto com muitos 500s repetidos de tentar obter o favicon)

==> proxy-host-2_access.log <==
[15/Aug/2023:17:03:34 +0000] - 400 400 - GET http hostname.domain "/portainer/" [Client 10.0.139.109] [Length 25] [Gzip -] [Sent-to hostname.domain] "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0" "-"

==> fallback_error.log <==
2023/08/15 17:03:34 [warn] 1471#1471: 512 worker_connections are not enough, reusing connections

It's simpler than you think, you just need to add a new location in custom locations in the location field /portainer/ and in the Forward Hostname / IP* fieldyour ip followed by / and the port number.

Because nginx itself already does the rest when saving the configuration

location /portainer/ {
   proxy_set_header Host $host;
   proxy_set_header X-Forwarded-Proto $scheme;
   proxy_set_header X-Real-Ip $remote_addr;
   proxy_set_header X-Forwarded-For $remote_add_x_forwarded_for;
   proxy_pass https://hostname.domain:9443/;
}
<!-- gh-comment-id:1752300402 --> @edsonsbj commented on GitHub (Oct 9, 2023): > **Lista** > > * Você puxou e encontrou o erro com a imagem do docker? `jc21/nginx-proxy-manager:latest` > * Sim > * Tem certeza de que não está usando a imagem docker de outra pessoa? > * Sim > * Você já pesquisou por problemas semelhantes (abertos e fechados)? > * Sim > > **Descreva o bug** > > Eu tenho o seguinte local definido em um que funciona exatamente como esperado`nginx.conf` > > ```nginx > location /portainer/ { > proxy_set_header Host $host; > proxy_set_header X-Forwarded-Proto $scheme; > proxy_set_header X-Real-Ip $remote_addr; > proxy_set_header X-Forwarded-For $remote_add_x_forwarded_for; > proxy_pass https://hostname.domain:9443/; > } > ``` > > Eu imaginei que seria tão fácil quanto adicionar um novo host proxy no Nginx Proxy Manager, adicionando o local e definindo as várias variáveis proxy_header na seção do local. No entanto, quando eu adiciono literalmente qualquer uma das linhas acima, o local lança um 400. Não consigo ver nada realmente "útil" nos logs de contêiner para nginx-proxy-manager.`/portainer/``advanced``proxy_set_header` > > Estou sentindo falta de alguma coisa? > > **Nginx Proxy Manager Versão** > > v2.10.4 > > **Para** reproduzir etapas para reproduzir o comportamento: > > 1. Criar novo host proxy > 2. Adicionar uma localização > 3. Adicionar (por exemplo) à seção avançada do local`proxy_set_header X-Real-IP $remote_addr;` > 4. Salve o local > 5. Navegar em uma nova guia até o local > 6. Observe 400 > > **Comportamento esperado** > > Espero que os valores sejam respeitados. Além disso, se houver um erro de configuração ocorrendo, alguma forma de notificação parece uma vantagem`proxy_set_header` > > **Imagens** > > Eu posso fornecê-los, se necessário > > **Sistema Operacional** > > * RHEL 8,8 > * Docker versão 24.0.5, build ced0996 > > **Contexto adicional** > > Executando sob composição usando o seguinte script de composição docker > > ```yaml > version: '3.8' > services: > app: > image: 'jc21/nginx-proxy-manager:latest' > restart: unless-stopped > ports: > - '80:80' # Public HTTP Port > - '443:443' # Public HTTPS Port > - '81:81' # Admin Web Port > - '5090-6000:5090-6000' # Snag up any other ports we might want to proxy to > volumes: > - /opt/docker/npm/:/data > ``` > > A única coisa que qualquer um dos arquivos de log emite ao salvar é > > > [aviso] 141#141: não foi possível construir proxy_headers_hash ideal, você deve aumentar proxy_headers_hash_max_size: 512 ou proxy_headers_hash_bucket_size: 64; ignorando proxy_headers_hash_bucket_size > > E ao atingir o ponto de extremidade criado, as 2 coisas a seguir são registradas (junto com muitos 500s repetidos de tentar obter o favicon) > > ``` > ==> proxy-host-2_access.log <== > [15/Aug/2023:17:03:34 +0000] - 400 400 - GET http hostname.domain "/portainer/" [Client 10.0.139.109] [Length 25] [Gzip -] [Sent-to hostname.domain] "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0" "-" > > ==> fallback_error.log <== > 2023/08/15 17:03:34 [warn] 1471#1471: 512 worker_connections are not enough, reusing connections > ``` It's simpler than you think, you just need to add a new location in custom locations in the location field /portainer/ and in the Forward Hostname / IP* fieldyour ip followed by / and the port number. Because nginx itself already does the rest when saving the configuration ``` location /portainer/ { proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_add_x_forwarded_for; proxy_pass https://hostname.domain:9443/; } ```
Author
Owner

@github-actions[bot] commented on GitHub (Jun 1, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2143212055 --> @github-actions[bot] commented on GitHub (Jun 1, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (Jun 5, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:2942526697 --> @github-actions[bot] commented on GitHub (Jun 5, 2025): Issue was closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#2123
No description provided.