Unresolved? YH-Letsencrypt certificate do not work for www and non www-domain?

Hi. I just realised that the letsencrypt certificate installed by Yunohost does not work for both www.my-yunohost-domain.com and my-yunohost-domain.com

I set up the site at my-yunohost-domain.com and I just realised that going to www.my-yunohost-domain.com gives me an error: “does not connect” because only a selfsigned certificate is issued for this domain. In my dns, a CNAME is already set for both www.my-yunohost-domain.com and my-yunohost-domain.com

I found two old threads about this issue, both unresolved:

But maybe I just overlooked something trivial? Thanks!

PS: More related issues: document common use case: (1) make default wordpress (2) redirect www · Issue #1518 · YunoHost/issues · GitHub and SSL certificate issue when accessing www.domain.tld · Issue #1638 · YunoHost/issues · GitHub

EDIT: It seems the solution is using the Redirect app? 'www.domain' does not show default Custom-Webapp as 'domain' alone does

Did you try connect on the server with ssh and this command sudo yunohost domain cert renew ??
Did you have added your subdomain www dns conf on your registar ?

Yes, I have. It seems that it does not work out of the box. Now I installed the Redirect app and now the problem is gone.

So, first add the www-domain to yunohost, get the letsencrypt certificate and then install the Redirect app, fill in the redirection details and then the website works with both www and without www

You can or have to create 2 domains :

  • my.domain
  • www.my.domain

And then you can install a certificate on each one of them.

Tschuss

Does this work for you? For me not. I tried that. The second domain would then direct to the YH-admin as my website (dokuwiki) is installed on the first domain. So, the Redirect app seems to be the only option, at least in my case.

Actually, I just realized that what I do is to
1- Install a certificate on www.my.domain
2-Redirect www.my.domain to my.domain

So you’re right.

@TheNomad11 this is a support request, moved to its proper section.

Please provide all necessary information (type of server, YunoHost version). Include your Diagnosis report, that’s important to check DNS.

As stated above, if you need to expose both my-yunohost-domain.com and www.my-yunohost-domain.com to the Internet, you need to register both of them as domains in your webadmin. Then you need to make sure the DNS records are correct (CNAME may not be enough,) before generating Let’s Encrypt certificates for both domains.

What you do with them afterwards is up to you. You can definitely setup a Redirect app to redirect from one to the other.

Thanks! @tituspijean Maybe this info could be added to the documentation here? Certificate | Yunohost Documentation I suppose this would be useful for many users. Not everybody might be aware of the extra steps needed for making both www and non-www work?