【问题标题】:Subdomain forwarding to main domain on ssl requests only仅在 ssl 请求上将子域转发到主域
【发布时间】:2017-01-21 08:18:49
【问题描述】:

以下是我编辑的 ssl.conf 的副本以删除任何识别信息。

目前,我们有一个通配符 SSL 证书,以及我们计划使用此证书托管的多个子域。 Apache confirms this should be possible

现在,域 2 正在转发到 www,但我不知道为什么。为了缩小范围,我从文件中完全删除了 www 虚拟主机并重新部署。 重定向仍然发生(并且作为唯一的虚拟主机,它加载了 domain2 文件结构)

我不知道这个重定向发生在哪里。证书可能有问题吗? (我确认证书上的通用名称是*.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>

【问题讨论】:

  • 是的,我以前读过。我把它留在了一个绝望的希望中,也许我在一个需要它的旧版本的 apache 上。
  • 你可以做到sudo apachectl -V(或-v,以适用于版本为准)
  • 在 domain2 中没有重定向或重写,因此在另一个虚拟主机中触摸任何东西都是徒劳的。删除您的浏览器缓存,或尝试curl -I https://domain2.example.com 并确保它是您的服务器回复而不是其他东西,如果有重定向,请尝试从重定向来自的标头中识别,但显然它不是在什么我们在配置中看到。
  • 山姆会怎么做?

标签: apache ssl virtualhost httpd.conf


【解决方案1】:

事实证明,我们有一个 301 重定向,将 domain2 指向 www。谷歌浏览器已经缓存了这个 301。在打开 devtools 的情况下禁用缓存会导致页面通过 ssl 正确加载。

【讨论】:

    猜你喜欢
    • 2019-11-18
    • 2020-01-06
    • 2020-04-24
    • 2021-09-11
    • 1970-01-01
    • 2011-08-02
    • 2011-07-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多