I have certificate for a.com that has two alternative domains: *.b.com and c.com. When I have the following in my /etc/hosts:

<IP_OF_test.b.com> b.com

If I then enter https://b.com in my browser, I would expect the server behind *.b.com to accept it but it gives the ERR_CERT_COMMON_NAME_INVALID error despite showing me that the certificate is for a.com and has the two alternative domains *.b.com and c.com

Am I trying to do something that is impossible?

The reason I need to be able to make something like this work is because I have a PhoneGap app, of which I don't have the source code, so the only way to test it (besides simply testing it in production) is to use a DNS spoofing app that redirects my b.com requests to test.b.com, but I can't get past the SSL certificate (on PC I can just accept the certificate, but no such luck for a PhoneGap app).

1 Answer 1


A certificate which includes a.com, *.b.com and c.com is valid only for subdomains of b.com (i.e. www.b.com) but not for b.com itself. The certificate would need to explicitly include b.com for this.

  • D'oh, didn't know that, thanks :-)
    – Mekswoll
    Dec 17, 2021 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .