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

The wildcard subdomain environment variable cause issues #1478

Open
imfaisalkh opened this issue Jul 22, 2020 · 4 comments
Open

The wildcard subdomain environment variable cause issues #1478

imfaisalkh opened this issue Jul 22, 2020 · 4 comments

Comments

@imfaisalkh
Copy link

imfaisalkh commented Jul 22, 2020

I'm using this image as following in my docker-compose.yml file:

version: "3"

services:
  # Server
  server:
    environment:
      VIRTUAL_HOST: server.example.com
      LETSENCRYPT_HOST: server.example.com

  # Dashboard
  dashboard:
    environment:
      VIRTUAL_HOST: dashboard.example.com
      LETSENCRYPT_HOST: dashboard.example.com

  # Sites
  sites:
    environment:
      VIRTUAL_HOST: *.example.com <------ THIS IS WORKING (see updated comment below)
      LETSENCRYPT_HOST: *.example.com <------ THIS IS CAUSING ISSUE

  # Root
  root:
    environment:
      VIRTUAL_HOST: example.com
      LETSENCRYPT_HOST: example.com

The reverse-proxy works fine if I don't use the wildcard subdomain under sites container. Once wildcard environment variable is included it does not work at all. Am I doing something wrong here? Although, the docs state that it is supported:

Wildcard Hosts

You can also use wildcards at the beginning and the end of host name, like .bar.com or foo.bar.. Or even a regular expression, which can be very useful in conjunction with a wildcard DNS service like xip.io, using ~^foo.bar..*.xip.io will match foo.bar.127.0.0.1.xip.io, foo.bar.10.0.2.2.xip.io and all other given IPs. More information about this topic can be found in the nginx documentation about server_names.

I want to catch all subdomains under sites container (provided that subdomain is not specifically assigned to any other container)

@imfaisalkh
Copy link
Author

I realized the wildcard subdomain is actually working for the VIRTUAL_HOST environment variable (i.e. it is correctly catching the subdomains and redirecting it to the correct web service). However, it is not working for LETSENCRYPT_HOST environment variable (i.e. SSL certificate is not being generated for wildcard subdomains)

Is it the expected behavior? Do I need to specify each potential subdomain specifically under LETSENCRYPT_HOST variable?

@melefabrizio
Copy link

Certbot allows wildcard domain to be issued only by DNS-01 challenge, which requires some manual action or API configuration

@tkw1536
Copy link
Collaborator

tkw1536 commented Jul 25, 2020

This is a known issue with docker-letsencrypt-nginx-proxy-companion, which doesn't support wildcard certs.
See nginx-proxy/acme-companion#319.

@imfaisalkh
Copy link
Author

This is a known issue with docker-letsencrypt-nginx-proxy-companion, which doesn't support wildcard certs.
See nginx-proxy/docker-letsencrypt-nginx-proxy-companion#319.

Yeah, I realized that therefore I'm looking for some other acme client which supports this feature.

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

No branches or pull requests

3 participants