简体   繁体   English

仅在ssl请求上将子域转发到主域

[英]Subdomain forwarding to main domain on ssl requests only

Below is a copy of my ssl.conf that I edited to remove any identifying information. 以下是我编辑的ssl.conf的副本,以删除所有标识信息。

Currently, we have a wild card SSL cert, and multiple sub domains that we plan to host with this certificate. 当前,我们有一个通配符SSL证书,并计划使用此证书托管多个子域。 Apache confirms this should be possible Apache确认这应该可行

Right now, domain 2 is forwarding to www, but I can;t figure out why. 目前,域2正在转发到www,但是我不知道为什么。 In an effort to narrow it down, I removed the www virtualhost from the file altogether and redeployed. 为了缩小范围,我从文件中完全删除了www虚拟主机,然后重新部署。 the redirect still happened (and as the only vhost, it loaded the domain2 file structure) 重定向仍然发生(并且作为唯一的虚拟主机,它加载了domain2文件结构)

I can't figure out where this redirect is happening. 我不知道这种重定向在哪里发生。 is it possible that there is an issue with the certificate? 证书是否可能有问题? (I confirmed that the common name on the certificate is *.example.com) (我确认证书上的通用名称是* .example.com)

Listen ip-of-server:443

LoadModule ssl_module   modules/mod_ssl.so

SSLPassPhraseDialog     builtin
AcceptMutex             flock
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
SSLMutex                default
SSLRandomSeed           startup /dev/urandom  256
SSLRandomSeed           connect builtin

NameVirtualHost ip-of-server:443

<VirtualHost ip-of-server:443>
        SSLEngine on
        SSLStrictSNIVHostCheck on

        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP

SSLCertificateFile /etc/apache/ssl/STAR.example.com.pem
SSLCertificateKeyFile /etc/pki/tls/private/example.com.key

        ServerName      "domain2.example.com"
        DocumentRoot    "/srv/www/domain2.example.com/public_html"

        CustomLog       "/srv/www/domain2.example.com/logs/access.log" combined
        ErrorLog        "/srv/www/domain2.example.com/logs/error.log"

        <Directory /var/www/html>
                AllowOverride none

                Order Allow,Deny
                Allow from all
        </Directory>
</VirtualHost>

<VirtualHost ip-of-server:443>
        SSLEngine on
        SSLStrictSNIVHostCheck on

        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP

SSLCertificateFile /etc/apache/ssl/STAR.example.com.pem
SSLCertificateKeyFile /etc/pki/tls/private/example.com.key

        ServerName      "www.example.com"
        DocumentRoot    "/srv/www/www.example.com/public_html"

        CustomLog       "/srv/www/www.example.com/logs/access.log" combined
        ErrorLog        "/srv/www/www.example.com/logs/error.log"

        <Directory /var/www/html>
                AllowOverride none

                Order Allow,Deny
                Allow from all
        </Directory>
</VirtualHost>

Turns out at some point we had a 301 redirect that pointed domain2 to www. 原来在某个时候,我们进行了301重定向,将domain2指向www。 Google chrome had cached that 301. disabling cache with devtools open caused page to load correctly over ssl. 谷歌浏览器chrome已缓存了301。在devtools打开的情况下禁用了缓存,导致页面可以通过ssl正确加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM