I have a Jenkins install at
ci.example.com, and a static site at
example.com. The Jenkins install is configured to use HTTPS exclusively. I'm a cheapskate, so I only have a certificate for the
ci.example.com domain. My Apache config looks like this:
<VirtualHost *:80> ServerName example.com DocumentRoot /var/www/html ErrorDocument 404 /404.html </VirtualHost> <VirtualHost *:80> ServerName ci.example.com Redirect permanent / https://ci.example.com </VirtualHost> <VirtualHost *:443> ServerName https://ci.example.com ServerAlias ci SSLEngine on SSLCertificateKeyFile /etc/apache2/ssl/ci.example.com.key SSLCertificateFile /etc/apache2/ssl/ci.example.com.crt SSLCertificateChainFile /etc/apache2/ssl/ci.example.com.ca-bundle # Some proxy magic to make Jenkins work </VirtualHost>
(actually, this is an Ubuntu machine, so I just pulled the relevant site config files and concatenated them; there's lots of other mostly-irrelevant config stuff in other files)
When I navigate to
https://example.com, I get a certificate error, because Apache is choosing the only available vhost on port 443. Is it possible to give the user a less-scary-looking connection refused error?
This answer says I can't just redirect from HTTPS to HTTP without a cert, which makes sense since you need to establish an SSL connection (with a cert) before you can send a 3xx. But I don't want to send a 3xx (or a 4xx, for that matter). I just want to refuse the connection entirely. Is there any way to do that?