mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-26 18:05:54 +03:00
[GH-ISSUE #749] Wildcard Domains (not SSL) #634
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#634
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @markwylde on GitHub (Dec 1, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/749
Great project, thanks for all your time on this.
This feature may already exist, and I just can't find any documentation for it. I'm happy to create a PR with docs if you can point me in the right direction.
Basically, everything is working perfectly with my new installation. However, I have to put each subdomain in manually. I would like to specify a wildcard domain, and have every subdomain map to a host.
Just to note, this isn't to do with HTTPS or LetsEncrypt.
Is your feature request related to a problem? Please describe.
I would like to be able to map
*.mydomain.comto the same IP address.Describe the solution you'd like

The screen below to accept a wildcard domain
Describe alternatives you've considered
Putting in each domain manually
Additional context
Add any other context or screenshots about the feature request here.
Use Case
Maybe a use case would help. Imagine I'm hosting GitLab (or a hypothetical GitHub) on my network with pages (GitHub Pages or GitLab Pages).
I want to let my users expose
THEIRORG.pages.gitlab.test.In my mind, the way to do this is have a wildcard entry:
*.pages.gitlab.testSo then if the user comes through to
http://testorg.pages.gitlab.test/testrepo, the request automaitcally get's forwarded to the one server.@burkeazbill commented on GitHub (Dec 1, 2020):
Looking for this as well. I can do with Traefik, but want to use NPM for others to more easily do things via UI rather than config files ;)
@1xPdd commented on GitHub (Dec 5, 2020):
I've had success essentially using 2 certificates:
*.example.comfor all subdomains and a separate certificate forexample.com.@markwylde commented on GitHub (Dec 7, 2020):
Just to clarify, this ticket isn't in regards to wildcard SSL certificates. But wildcard domain name matching. Essentially, you could load balance to two http (not https) endpoints. IE:
For the following:
http://test1.example.com -> 192.168.1.10
http://test2.example.com -> 192.168.1.10
http://anything.example.com -> 192.168.1.10
The rule would be:
http://*.example.com -> 192.168.1.10
@hhannis commented on GitHub (Jan 3, 2021):
yes, want this!
@mosaati commented on GitHub (Jan 12, 2021):
AFAIK, to be able to ask nginx to route a specific domain to a specific IP address it has to know to which port. Having all domain and subdomains routed to the same IP address wouldn't make sense because they would require different ports for them to function.
You could have them all on the same IP, that doesn't matter much. But let's take your examples http://test1.example.com -> 192.168.1.10 and http://test2.example.com -> 192.168.1.10 are for example running on ports 8080 and 8081 (they cannot have the same port since they are served on the same IP) you would have to add 2 entries in NPM to define those ports separately.
If you mean strictly load balancing, it could be done by having a stream configuration. Although it is an area that might require some further work.
@markwylde commented on GitHub (Jan 12, 2021):
Hey @mosaati, thanks for your comment.
That's exactly the scenario I want. I want both test1 and test2 to point to 192.168.1.10:80 (the same port).
Take an example nodejs server:
So to clarify: I would like to point a wildcard domain to the same IP and port.
@mosaati commented on GitHub (Jan 12, 2021):
Then I think you would need a stream configuration. Have you tried it?
@schniper commented on GitHub (Feb 8, 2021):
This is not accurate. I am currently using the following config to serve websites from all subfolders in a main folder, using something like this:
server {
listen 80 default_server;
server_name ~^(?sname.+).loc$ _;
}
server {
listen 443 default_server;
server_name ~^(?sname.+).loc$ _;
}
sname above actually has to be specified like an html tag, using angular brackets, but the editor stripped them out.
I see backslashes are gone too, but you get the idea.
And then reference the active domain using the $sname variable. So routing based on domain name. All on the same port:
root "/var/www/$sname/public";
location / {
root "/var/www/$sname/public";
try_files $uri $uri/ /index.php$is_args$args;
autoindex off;
index index.html index.htm index.php;
}
etc...
This would indeed be a very useful feature.
The regular expression should be editable, so that, for example, we could have a separate route for the admin site on the same domain or different route sets for other specific websites (I am using exclusions to leave out websites which need specific rules, like cms ones with special configs, etc.)
The idea is this is totally doable.
I have tried doing this, but the admin only lets me include a single asterisk and then fails to validate the domain name. So probably someone started testing something like this but eventually quit.
@hydridity commented on GitHub (Feb 12, 2021):
Indeed would be nice to have support for this, i'm using ngix-proxy-manager as entry point behind NAT for multiple services being accessible via different subdomains pointed to one public ip.
Today i needed to test system that would serve additional resources based on consuming the header containing wildcard subdomain of subdomain (for example *.test.domain.com) and because the nature of this is dynamic, i cannot just set static proxy hosts in ngix-proxy manager because i can never know what the next one will be.
I think the same problem would occur when two reverse proxy layers are required, while the first one would simply redirect all requests of domain or subdomain and all of it's wildcard subdomains, the second one would then do all the required redirection.
Right now it is not possible when the ngix-proxy-manager is the first reverse proxy, or i have missed something important.
@mantasio commented on GitHub (Apr 16, 2021):
This would be a really useful feature. Especially if you are working in development with CI/CD and want to have different environments for, let's say, each git branch. Right now, you would need to add a new entry in NPM each time after deployment is done, which isn't very handy
@PraUrb commented on GitHub (May 8, 2021):
I'm not quite sure whether that's exactly what you want, but maybe you could try this:
Create a new Proxy Host with the name "example.org" and assign it the SSL Certificate for *.example.com
In the "Advanced" tab add this:
server_name *.example.org;If you add a new host now, e.g. "test.example.org", Nginx Proxy Manager will pass the request to the IP defined on this specific host, because its server name matches exactly and it therefor has a higher priority. But if you try to access "test2.example.org" (which you haven't explicitly defined!), it will pass the request to the Proxy Host with the name "example.org".
@markwylde commented on GitHub (May 9, 2021):
This actually sounds like this could work and not too complicated either. I'll try when I'm next working on this project, and let you know.
@PFindersDomain commented on GitHub (Jul 30, 2021):
How does one enter *.domain.com as this does not show the add option when I type this in, but this screenshot shows it added.

@iamkyoumei commented on GitHub (Aug 13, 2021):
Is it possible to extend support for this to sub subdomains? ie. *.test.domain.com ?
@chaptergy commented on GitHub (Aug 13, 2021):
It seems the only issue was the regex pattern. The fix was added in v2.9.5, so from there and up this works. I have tested it on v2.9.6 and both first-level and second-level wildcards for proxy hosts work as expected.