Adding default remote

Hello.

I want to create image server.
I added remote using ~/.config/lxc/config.yml
I created a script for generating config.yml with remote I need before installing lxd.
This way user doesn’t need to configure remotes with lxc remote add.
I can see my remote using lxc remote list.
But when I connect to remote I get a error:

Error: Get https://public_ip:8443/1.0: x509: certificate is valid for private_ip, not public_ip

When I use lxc remote add command everything works fine. But for me better to use config.yml.
Is there any way to solve this problem?

Thanks.

Client:
lxd 3.0.0

Remote
lxd 2.0.11

That’s because you’re missing the matching server certificate in ~/.config/lxc/servercerts

Thank you it worked.
I have another question.
How to create remote like “ubuntu” remote?
For example, if I’m going to use the method with config.yml I need to have certificate always in sync in case if remote change the certificate.
But how I understand it’s not the case when you use “ubuntu” remote.

Our public remotes (ubuntu, ubuntu-daily and images) all use valid TLS certificates so don’t need a copy of the certificate in servercerts.

Thanks.
I also fund how I can setup similar configuration (https://github.com/lxc/lxd/issues/1581)