Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support exposing multiple ports per virtual host #1405

Closed
wants to merge 1 commit into from

Conversation

BobSilent
Copy link

Allows to have different ports for multiple virtual hosts.

VIRTUAL_PORT can have a list of port mappings hostPort:containerPort or as of now only containerPort.
E.g. VIRTUAL_PORT=443:80,3000,4000:8086 will expose containter port 80 to host port 443, 3000 to 3000 and container port 8086 to host port 4000.

For Backward compatibility: providing only a single containerPort, the port will be mapped to either Port 80 or 443 as of today.

requires nginx-proxy/docker-gen#319

@ironrai
Copy link

ironrai commented Apr 8, 2020

I need this so much!

@arnaudsm
Copy link

arnaudsm commented Apr 8, 2020

Same here, this is a precious feature, great work !

@Silur
Copy link

Silur commented Apr 10, 2020

MEEERGE I NEED THIS

@zoedaemon
Copy link

I really need this...in case containers in development env different to env production

@tjhiggins
Copy link

+1

@joshghent
Copy link

This would be great to have. Would love to run unifi-controller on a reverse proxy but requires multiple ports exposed.

@lusk
Copy link

lusk commented May 27, 2020

Thanks @BobSilent for the code! 🎉 I couldn't wait for it to be merged so I built my own image with docker-gen binary compiled from nginx-proxy/docker-gen#319, but I was getting this during proxy container startup:
dockergen.1 | 2020/05/27 21:22:38 Unable to parse template: template: nginx.tmpl:266: undefined variable "$defaut_external_http_port". I was able to get further by hard-coding "80" instead of the undefined variable at lines 266 and 268 of nginx.tmpl, but then I'm getting this error instead: dockergen.1 | 2020/05/27 21:25:12 Unable to parse template: template: nginx.tmpl:422: unexpected EOF. Do you have any idea what might have gone wrong?

@lusk
Copy link

lusk commented May 28, 2020

Never mind, figured it out 😤 There's a typo in the variable name (mind the missing l in $defaut_external_http_port) and also there seem to be some "unclosed" {{ range }} blocks that produce the unexpected EOF errors. I also found that I probably need to wrap the whole server block with it (I'm not an nginx expert though so keep that in mind). Anyway, here is a gist with my working template: https://gist.github.com/lusk/25fdf859fd92ab4ea8f702911fc896fc
Thanks again for the code @BobSilent 👍

@leachiM2k
Copy link

Hi @lusk & @BobSilent,
I really like your pull request and I need on my system. Before compiling and building myself: Do you have a docker image for that on docker hub?
Thanks in advance.

@buchdag buchdag added status/pr-needs-tests This PR needs new or additional test(s) type/feat PR for a new feature labels Dec 26, 2022
@buchdag buchdag added the scope/multiport Issue or PR related to multi port proxying label Dec 19, 2023
@buchdag buchdag mentioned this pull request May 3, 2024
@buchdag
Copy link
Member

buchdag commented May 9, 2024

Superseded by #2434

@buchdag buchdag closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope/multiport Issue or PR related to multi port proxying status/pr-needs-tests This PR needs new or additional test(s) type/feat PR for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants