nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

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

Open GAS85 opened this issue 3 years ago • 7 comments

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;
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.

GAS85 avatar Jan 03 '23 12:01 GAS85

I have the similar need, to be able to set a custom listening port for a specific domain/vhost/proxy host

lerra avatar Feb 12 '23 10:02 lerra

Same here, adding proxy_set_header Host $host in the custom setting of the "/" location will cause entry duplicate in the config file 😢

etonline avatar May 31 '23 13:05 etonline

The same issue

YUJX19 avatar Oct 29 '23 05:10 YUJX19

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

github-actions[bot] avatar Jun 12 '24 01:06 github-actions[bot]

👍

GAS85 avatar Jun 12 '24 09:06 GAS85

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

github-actions[bot] avatar Mar 17 '25 02:03 github-actions[bot]

👍

GAS85 avatar Mar 17 '25 10:03 GAS85

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

github-actions[bot] avatar Dec 28 '25 02:12 github-actions[bot]

I would love to see this feature

lerra avatar Dec 28 '25 03:12 lerra