On a shared server, we have some sites that only run on port 80. However, there are other sites that run on both port 80 and 443.
For example:
<VirtualHost *:80>
ServerName unsecure.com
</VirtualHost>
<VirtualHost *:80>
ServerName secure.com
RedirectPermanent / https://secure.com
</VirtualHost>
<VirtualHost *:443>
ServerName secure.com
</VirtualHost>
Requests to https://unsecure.com will be presented the certificate for secure.com. Is there any way to avoid this other than separating out the interfaces (i.e. foo:80 and bar:443 which isn't possible in this situation). Many of these sites on port 80 are legacy sites, and setting them up to use SSL isn't as straightforward as we had hoped.
ERR_SSL_UNRECOGNIZED_NAME_ALERT
error code will avoid the user seeing a warning about an invalid certificate. In Chromium the error page produced byERR_SSL_UNRECOGNIZED_NAME_ALERT
looks similar to the one produced in case of a RST packet which is what they'd see if you simply weren't listening on port 443. I don't know if this is something Apache can do, which is why I am posting this as a comment rather than an answer.