What you want to do is impossible. That's why.
The certificate will contain a set of names (Common Name, possibly together with alternative object names, including wildcard names).
The client web browser will do the following:
- The user wanted to visit " https://myapp.mydomain.com/blog/posts/1 ".
- The request is made via SSL, and the domain name in the request is "myapp.mydomain.com".
- Get a certificate from a web server.
- Make sure that at least one of the certificate names matches the domain name in the request or matches the wildcard.
- Display page.
Therefore, you need a certificate with the exact domain name (or a wildcard matching the exact domain name) with which the application will be used. And the certificate should be available at the same time or later, when the exact domain name of the website becomes known and cannot be available earlier.
You seem to underestimate that somehow the certificate can "create" or "establish" an SSL connection. This is not true. The web server โ Apache, IIS, Nginx, LigHTTPD, or whatever you use โ is a program that knows how every aspect of an SSL connection is. A certificate is just a file that a web server sends to a client without even opening and using it.
In addition, the author of Webapp, which will be distributed, is not responsible for the creation or distribution of certificates and should not be under the misunderstanding that he is responsible. Only the website owner should be responsible for obtaining the certificate for their website. As another person noted, during the installation process, or perhaps in the process after installation, you can ask the person installing the webapp for the certificate. But this is the best you can do.
source share