[GH-ISSUE #586] Websocket support for another port than default (with fix) #495

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

Originally created by @Hanarion on GitHub (Aug 29, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/586

Describe the bug

  • When the port used for reverse proxy is not 443 or 80 websockets doesnt works

To Reproduce
Steps to reproduce the behavior:

  1. Map another port that 443 or 80 on the host side to the docker container
  2. try to connect to a websocket
  3. you'll get a 403 error

Expected behavior
Working websocket

Solution
Change code of include/proxy.conf to :

add_header       X-Served-By $http_host;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto  $scheme;
proxy_set_header X-Forwarded-For    $remote_addr;
proxy_pass       $forward_scheme://$server:$port;

$host is changed to $http_host in order to fix that problem

Originally created by @Hanarion on GitHub (Aug 29, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/586 **Describe the bug** - When the port used for reverse proxy is not 443 or 80 websockets doesnt works **To Reproduce** Steps to reproduce the behavior: 1. Map another port that 443 or 80 on the host side to the docker container 2. try to connect to a websocket 3. you'll get a 403 error **Expected behavior** Working websocket **Solution** Change code of `include/proxy.conf` to : ``` add_header X-Served-By $http_host; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass $forward_scheme://$server:$port; ``` $host is changed to $http_host in order to fix that problem
kerem 2026-02-26 06:33:06 +03:00
  • closed this issue
  • added the
    stale
    bug
    labels
Author
Owner

@luastoned commented on GitHub (Apr 19, 2021):

I think this issue is still ongoing?

<!-- gh-comment-id:822262756 --> @luastoned commented on GitHub (Apr 19, 2021): I think this issue is still ongoing?
Author
Owner

@thorsten-gehrig commented on GitHub (Jan 18, 2022):

I´m also looking forward to have a fix for this. My Websocket is on port 8080....

<!-- gh-comment-id:1015827699 --> @thorsten-gehrig commented on GitHub (Jan 18, 2022): I´m also looking forward to have a fix for this. My Websocket is on port 8080....
Author
Owner

@github-actions[bot] commented on GitHub (Mar 25, 2024):

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

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

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

Issue was closed due to inactivity.

<!-- gh-comment-id:2849747745 --> @github-actions[bot] commented on GitHub (May 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#495
No description provided.