NginxProxyManager / NginxProxyManager/nginx-proxy-manager

Support other ports (non 80/443) configuration in headers via UI settings

Open
#2,516 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
34.2k
Forks
3.9k
Avg merge
21h 12m
Merged PRs (30d)
20

Description

Is your feature request related to a problem? Please describe.
If my Application runs on different ports, e.g. 907X it will cause a bunch of trouble - port will not be forwarded to the service and at the end redirect happens on port 80 or 443 that are not configured by npm.
Docker-compose

version: "3.6"
services:
  nginx-proxy-manager:
    image: jc21/nginx-proxy-manager:latest
    container_name: npm
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - DB_SQLITE_FILE=/config/database.sqlite
      - DISABLE_IPV6=true
    ports:
      # Public HTTP Port. Port Forwarding on Router is ON.
      - 9070:80
      # Public HTTPS Port. Port Forwarding on Router is ON.
      - 9071:443
      # Admin Web Port. Port Forwarding on Router is OFF. Internal Home Network Access only - 192.168.89.254:81.
      - 9072:81
    volumes:
      - ${WORKINGDIR}/docker/npm/config:/config
      - ${WORKINGDIR}/docker/npm/letsencrypt:/etc/letsencrypt
      - ${WORKINGDIR}/docker/npm/data:/data

изображение

On a 1st line Service was found and it tells us to follow url http://jackett.fritz.box:9070/UI/Dashboard.
On a 2nd line Service would like to authorize user, but do not know port, so it skip it in a answer and ended up with wrong URL (no port) http://jackett.fritz.box/UI/Login?ReturnUrl=/UI/Dashboard and 404.

Describe the solution you'd like
Configure port in a proxy_set_header Host $host:PORT; will solve this issue.

изображение

Unlike current solution it is only proxy_set_header Host $host;. Add Possibility to enable and add custom port to the header Host.

Describe alternatives you've considered
I tried to use "Custom Location" and set it to the root so I can add proxy_set_header Host $host:PORT; but this will cause this entry twice: without port and at the end with port that cause an error.

Alternative 2 is to mount proxy.conf to the host machine:

    volumes:
      - ${WORKINGDIR}/docker/npm/data/nginx/include/proxy.conf:/etc/nginx/conf.d/include/proxy.conf

and update it:

add_header       X-Served-By $host;
#proxy_set_header Host $host:9070;
# Forward host and port
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    $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP          $remote_addr;
proxy_pass       $forward_scheme://$server:$port$request_uri;

Additional context
There is no need to modify listen 80; part of the configuration and bind nginx to some other ports, it shall remains untouched. But underlining services need to know the Port.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the proxy-host UI settings into the generated Nginx configuration, using the issue's proxy.conf example and Docker Compose setup as context. Done means a user can configure a non-80/443 public port in the UI and the resulting upstream Host header preserves that port without duplicate directives or breaking existing proxy hosts.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, nginx, typescript
Domain
devops, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.