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

Enable use of wildcard location configurations #588

Merged
merged 2 commits into from
Oct 10, 2019

Conversation

buchdag
Copy link
Member

@buchdag buchdag commented Oct 10, 2019

This PR is a fix for #561

It makes the location configuration work as follow. Let say the domain is foo.bar.baz.example.tld:

  • if a config file with the exact same name as your domain (foo.bar.baz.example.tld) is present, use it.
  • else try every corresponding wildcard domain, from most qualified to least qualified, first ascending through the labels to the base domain (*.bar.baz.example.tld, *.baz.example.tld, *.example.tld) then descending (foo.bar.baz.example.*, foor.bar.baz.*, foo.bar.*, foo.*). The first matching config file will be used.
  • if no wildcard location config file was found either, use the default location config file.

@buchdag
Copy link
Member Author

buchdag commented Oct 10, 2019

plus corresponding tests

@buchdag buchdag added kind/bug Issue reporting a bug kind/feature-request Issue requesting a new feature labels Oct 10, 2019
@buchdag buchdag merged commit d26118f into nginx-proxy:master Oct 10, 2019
@buchdag buchdag deleted the fix-561 branch October 10, 2019 09:31
@jayhar
Copy link

jayhar commented Oct 23, 2019

Previously to achieve a wildcard SSL for all subdomains I have been using the following example. Two A records are needed to make this work. Note I do not force redirect from non-www to www.

docker run -d -e VIRTUAL_HOST=.example.com -e LETSENCRYPT_HOST=www.example.com,example.com -e LETSENCRYPT_EMAIL=example@example.com --network=exampleproxy --name example.com -v /srv/www/nginx-data/html/example.com:/usr/local/apache2/htdocs httpd:alpine

With the changes you made (thank you for your work) am I am able to to change my current syntax to -e VIRTUAL_HOST=example.com -e LETSENCRYPT_HOST=example.com to achieve the same scenario? The issue I had before is the NGINX config had to manually modified to make this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issue reporting a bug kind/feature-request Issue requesting a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants