Skip to content

RFC: feat: Support multiple networks by running multiple instances of nginx-proxy#2660

Closed
p12tic wants to merge 1 commit into
nginx-proxy:mainfrom
p12tic:vhost-prefix
Closed

RFC: feat: Support multiple networks by running multiple instances of nginx-proxy#2660
p12tic wants to merge 1 commit into
nginx-proxy:mainfrom
p12tic:vhost-prefix

Conversation

@p12tic

@p12tic p12tic commented Sep 14, 2025

Copy link
Copy Markdown
Contributor

I'm not sure if it makes sense nginx-proxy to support a feature like this, but I already have a proof of concept and instead of opening an issue a PR was created straight away. Let me know if the feature itself makes sense and I will rewrite PR in any way needed.


This feature is useful in cases there are multiple networks to be managed with nginx-proxy on the same host. For example, a public network and a network that can only be reached through a VPN.

This commit makes it possible to use multiple instances of nginx-proxy in such use cases. Each instance has a separate "namespace" of VIRTUAL_HOST and VIRTUAL_HOST_MULTIPORTS variables used by containers, controlled by VIRTUAL_HOST_ENV_PREFIX environment variable set on the nginx-proxy. E.g. set VIRTUAL_HOST_ENV_PREFIX=VIRTUAL_HOST_MY_NETWORK, and only containers with VIRTUAL_HOST_MY_NETWORK=something will be managed by that nginx-proxy instance.

This is useful in cases there are multiple networks to be managed with
nginx-proxy on the same host. For example, a public network and a
network that can only be reached through a VPN.

This commit makes it possible to use multiple instances of nginx-proxy
in such use cases. Each instance has a separate "namespace" of
VIRTUAL_HOST and VIRTUAL_HOST_MULTIPORTS variables used by containers,
controlled by VIRTUAL_HOST_ENV_PREFIX environment variable set on the
nginx-proxy. E.g. set VIRTUAL_HOST_ENV_PREFIX=VIRTUAL_HOST_MY_NETWORK,
and only containers with VIRTUAL_HOST_MY_NETWORK=something will be
managed by that nginx-proxy instance.
@p12tic p12tic changed the title RFC: feat: Add configurable virtual host environment prefix support RFC: feat: Add configurable VIRTUAL_HOST envvar name support Sep 14, 2025
@p12tic p12tic changed the title RFC: feat: Add configurable VIRTUAL_HOST envvar name support RFC: feat: Support multiple networks by running multiple instances of nginx-proxy Sep 14, 2025
@p12tic

p12tic commented Sep 14, 2025

Copy link
Copy Markdown
Contributor Author

Turns out #2659 implements support for similar use case by using a different approach.

@p12tic p12tic closed this Sep 14, 2025
@p12tic

p12tic commented Sep 14, 2025

Copy link
Copy Markdown
Contributor Author

Closing because nginx-proxy/docker-gen#276 will implement the same.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant