[GH-ISSUE #2804] X-Forwarded-Host missing from default proxy.conf #1929

Open
opened 2026-02-26 07:33:18 +03:00 by kerem · 4 comments
Owner

Originally created by @thor0215 on GitHub (Apr 4, 2023).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2804

The default proxy.conf file is missing the X-Forwarded-Host header
github.com/NginxProxyManager/nginx-proxy-manager@67208e43cc/docker/rootfs/etc/nginx/conf.d/include/proxy.conf (L1-L7)

add_header X-Served-By $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass $forward_scheme://$server:$port$request_uri;

This should be added to the above config:
proxy_set_header X-Forwarded-Host $http_host;

This breaks code-server currently when using the default NGinx Proxy Manager settings
https://github.com/coder/code-server

Originally created by @thor0215 on GitHub (Apr 4, 2023). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2804 The default proxy.conf file is missing the X-Forwarded-Host header https://github.com/NginxProxyManager/nginx-proxy-manager/blob/67208e43cc41f659ae2e68baa58a181a4d5f465b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf#L1-L7 add_header X-Served-By $host; proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_pass $forward_scheme://$server:$port$request_uri; This should be added to the above config: proxy_set_header X-Forwarded-Host $http_host; This breaks code-server currently when using the default NGinx Proxy Manager settings https://github.com/coder/code-server
Author
Owner

@662 commented on GitHub (Apr 15, 2023):

X-Forwarded-Port

<!-- gh-comment-id:1509628587 --> @662 commented on GitHub (Apr 15, 2023): X-Forwarded-Port
Author
Owner

@github-actions[bot] commented on GitHub (Jan 23, 2024):

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

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

@medram commented on GitHub (Feb 11, 2025):

Hello everyone, I run into the same issue, and I solved it like this:

npm:
    image: jc21/nginx-proxy-manager:2.12.1
    ports:
      - "80:80"
      - "443:443"
      - "8090:81"
    environment:
     ...
    volumes:
      - ${NFS_DOCKER_VOLUMES}/npm_volume/data:/data
      - ${NFS_DOCKER_VOLUMES}/npm_volume/letsencrypt:/etc/letsencrypt
      # Fixed by mounting it to this path.       
      - ./configs/server_proxy.conf:/data/nginx/custom/server_proxy.conf

My config file ./configs/server_proxy.conf:

# Required to pass the real client IP address to the backend services 
real_ip_header CF-Connecting-IP;

Note: You can change CF-Connecting-IP with anything you want if needed.

<!-- gh-comment-id:2651995435 --> @medram commented on GitHub (Feb 11, 2025): Hello everyone, I run into the same issue, and I solved it like this: ```yml npm: image: jc21/nginx-proxy-manager:2.12.1 ports: - "80:80" - "443:443" - "8090:81" environment: ... volumes: - ${NFS_DOCKER_VOLUMES}/npm_volume/data:/data - ${NFS_DOCKER_VOLUMES}/npm_volume/letsencrypt:/etc/letsencrypt # Fixed by mounting it to this path. - ./configs/server_proxy.conf:/data/nginx/custom/server_proxy.conf ``` My config file `./configs/server_proxy.conf`: ```txt # Required to pass the real client IP address to the backend services real_ip_header CF-Connecting-IP; ``` Note: You can change `CF-Connecting-IP` with anything you want if needed.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 14, 2025):

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

<!-- gh-comment-id:3289094500 --> @github-actions[bot] commented on GitHub (Sep 14, 2025): Issue is now considered stale. If you want to keep it open, please comment :+1:
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#1929
No description provided.