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 2 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