Skip to content

Conversation

@nanawel
Copy link
Contributor

@nanawel nanawel commented Nov 3, 2019

This PR allows to choose arbitrary ports for HTTP and HTTPS instead of 80 and 443.

While it does not change anything in the way ports can be mapped to host using native Docker capabilities, it fixes the "invalid" X-Forwarded-Port when the port on which nginx listens to is different from the one it is mapped - and accessed by clients - on the host.

Typical usage in docker-compose (here with the custom ports 1080 and 10443):

  reverse-proxy:
    image: jwilder/nginx-proxy
    ports:
      - "1080:1080"
      - "10443:10443"
    environment:
      HTTP_PORT: "1080"
      HTTPS_PORT: "10443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

I'm open to suggestions.
Thanks for your amazing work on this image, it helps a lot.

Regards,

@jwilder jwilder merged commit b470963 into nginx-proxy:master Mar 3, 2020
@nanawel nanawel deleted the feature/custom-external-ports-support branch March 3, 2020 05:31
@addshore
Copy link

addshore commented Mar 3, 2020

Is there any timeline for this feature getting into the jwilder docker images?
We were just looking into finding something like this, and then discovered this PR merged a few hours ago!

@DrRSatzteil
Copy link

Will this also create correct redirects from HTTP_PORT to HTTPS_PORT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/pr-needs-docs This PR needs new or additional documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants