【发布时间】:2014-08-19 01:40:22
【问题描述】:
我想始终使用 https 并拥有一个规范域。问题是当我与辅助域建立 https 连接时,一切都会崩溃,因为证书是用于主域的。有没有办法解决这个问题,还是我必须为我的所有域购买证书,而不仅仅是规范域?
我的“/etc/apache2/apache2.conf”的相关部分
# Canonical hostname and always use https
<IfModule mod_rewrite.c>
RewriteEngine On
# force https on primary host (works fine)
# http://primary-host.com -> https://primary-host.com
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^primary-host\.com$
RewriteRule (.*) https://primary-host.com%{REQUEST_URI}
# force https and redirect to primary host (works fine)
# http://secondary-host.com -> https://primary-host.com
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^secondary-host\.com$
RewriteRule (.*) https://primary-host.com%{REQUEST_URI}
# FAIL: Certificate doesn't match and "Bad Request (400)" if accepted!
# https://secondary-host.com -> https://primary-host.com
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^secondary-host\.com$
RewriteRule (.*) https://primary-host.com%{REQUEST_URI}
</IfModule>
【问题讨论】: