Use SSL certificate for DNS redirected domains
On my VPS server with WHM, I have 2 accounts: domain1 and domain2.
Each of these domains are the main domains for their accounts. Meaning that domain1 has other alias domains as well, and domain2 has also some additional alias domains. The ip of these accounts is different. Meaning that domain1 has one ip and domain2 has it's own ip.
For domain1, I've added a DNS A record that points to domain2's ip. Now, when accessing domain1, the website from domain2 is server as expected because of this "redirection", which is what I want.
Both of these domains, have also SSL valid certificates for their own domains and alias domains.
The problem is that when I access domain1 and the website from domain2 is returned, the SSL certificate from domain2 is also returned, which of course does not cover the domain1, meaning that the connection is marked as unsecure.
I've checked with 'whynopadlock' and the result was the expected one: the SSL certificate is valid indeed, but since it belongs from domain1, it does not provide coverage for domain2 as well.
Therefore, how can I fix this SSL issue?
Please note that this behavior was successfully working on my previous server, but I had to migrate it to a new server where it doesn't work anynore and I don't know how it did worked on the previous server. One thing for sure is that there was no multi domain SSL certificate, but everything worked by default using AutoSSL and SSL certificates provided by Let's Encrypt for free.
-
"For domain1, I've added a DNS A record that points to domain2's ip. Now, when accessing domain1, the website from domain2 is server as expected because of this "redirection", which is what I want"
This isn't a 'redirection'. When you set the A record to the second IP it basically asks the web server to display the content from the IP so the browser sees domain1 but the server shows the content and SSL cert from domain2.
You would be best to do a 301/302 redirect from domain1 (having domain1 set to its correct IP) to domain2.
Or park domain1 on top of domain2
0
Please sign in to leave a comment.
Comments
1 comment