HTTPがHTTPSにリダイレクトされると、Apache httpdリバースプロキシはSSL_ERROR_RX_RECORD_TOO_LONGを返します。

HTTPがHTTPSにリダイレクトされると、Apache httpdリバースプロキシはSSL_ERROR_RX_RECORD_TOO_LONGを返します。

Atlassian Confluenceをホストしている他のサーバーに対してApache v2.4 httpdリバースプロキシを設定しています。

プロキシのプライベートIPアドレスは10.0.0.77、パブリックIPアドレスは77.77.77.77、DNS AレコードはパブリックIPをここにマップしますconfluence.example.com

NATがあります。

  • 77.77.77.77:10080 -> 10.0.0.77:80
  • 77.77.77.77:10443 -> 10.0.0.77:443

これは、プロキシのパブリックIPアドレスが他のサービスにも使用されるために必要です。

プロキシの名前解決は、ConfluenceサーバーのプライベートIP 10.0.0.9に/etc/hostsマッピングされていることによって行われます。confluence.example.com

これは次のとおりです/etc/httpd/conf.d/confluence.conf(ご覧のとおり、HTTPからHTTPSへのリダイレクトも行います)。

<VirtualHost *:80>
    ServerName confluence.example.com
    ProxyRequests off
    ProxyPreserveHost off
    SetEnv force-proxy-request 1
    SetEnv proxy-nokeepalive 1
    ProxyPass        "/" "http://confluence.example.com:8090/" 
    ProxyPassReverse "/" "http://confluence.example.com:8090/"
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

<VirtualHost *:443>
    ServerName confluence.example.com
    ServerSignature On
        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>
    SSLEngine on
    SSLProtocol ALL -SSLv2 -SSLv3
    SSLHonorCipherOrder on
    # SSL cipher suite shortened for clarity
    SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384"
    SSLCertificateFile    /etc/httpd/ssl/example.crt
    SSLCertificateKeyFile /etc/httpd/ssl/example.key
    SSLCACertificateFile  /etc/httpd/ssl/example.crt
    ProxyRequests off
    ProxyPreserveHost on 
    ProxyPass        "/" "http://confluence.example.com:8090/" 
    ProxyPassReverse "/" "http://confluence.example.com:8090/"
</VirtualHost>

訪問するときhttp://confluence.example.com:10080(でもhttp://77.77.77.77:10080)ブラウザでURLを次に変更します。https://confluence.example.com:10080ただし、Confluenceログインページは表示されず、代わりに次のエラーが返されます。

セキュア接続の失敗
77.77.77.77:10080への接続中にエラーが発生しました。 SSLが許可された最大長を超えるレコードを受信しました。エラーコード:SSL_ERROR_RX_RECORD_TOO_LONG

httpアクセスログ(DEBUGレベル)に記録される内容は次のとおりです。

33.33.33.33 - - [17/Sep/2018:17:06:59 +0200] "GET / HTTP/1.1" 302 208 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0"
33.33.33.33 - - [17/Sep/2018:17:06:59 +0200] "\x16\x03\x01\x02" 400 226 "-" "-"

そしてhttpエラーログ:

[Mon Sep 17 17:11:58.095085 2018] [core:debug] [pid 23120] protocol.c(1271): [client 33.33.33.33:49745] AH00566: request failed: malformed request line

別のhttpsアクセスとエラーログを設定しましたが、何も記録されません。推測されましたが、33.33.33.33は私が発信するパブリックIPです。

入場https://confluence.example.com:10443うまくいきます。

同じ設定が異なるApache v2.2リバースプロキシでも機能します。

どのようなヒントがありますか?

ベストアンサー1

Tomcatインスタンスに対してこれを行います。 (以前はConfluence、現在はXWikiです。)

  1. http→https vHostはプロキシなしで直接リダイレクトされます。
  2. https vHostはURIに合理的なパターンがあることを知っているので、Tomcatのプロキシの書き換えを管理します。

私の設定の(少し)編集されたバージョンは次のとおりです。

<VirtualHost *:80>
        ServerAdmin [email protected]

        ServerName confluence.example.com

        DocumentRoot /home/www/confluence.example.com/docroot


        # Global protection
        #
        <Directory />
                Options none
                AllowOverride None
        </Directory>


        # Send users to canonical website
        #
        Redirect / https://confluence.example.com/


        # Logging
        #
        ServerSignature On
        LogLevel warn
        ErrorLog "|/usr/bin/cronolog /home/www/confluence.example.com/logs/%Y/%m/%d/public-error.log"
        CustomLog "|/usr/bin/cronolog /home/www/confluence.example.com/logs/%Y/%m/%d/public-access.log" combined

</VirtualHost>

<VirtualHost *:443>
        ServerAdmin [email protected]

        ServerName confluence.example.com

        DocumentRoot /home/www/confluence.example.com/docroot
        AddDefaultCharset UTF-8


        # Global protection
        #
        <Directory />
                Options none
                AllowOverride None
        </Directory>


        # Access to the application itself
        #
        ProxyPassMatch /(.*) http://confluence.example.com:8090/$1
        ProxyPassReverse / http://confluence.example.com:8090/
        ProxyPassReverseCookieDomain confluence.example.com confluence.example.com


        # Logging
        #
        ServerSignature On

        LogLevel warn rewrite:debug
        ErrorLog "|/usr/bin/cronolog /home/www/confluence.example.com/logs/%Y/%m/%d/secure-error.log"
        CustomLog "|/usr/bin/cronolog /home/www/confluence.example.com/logs/%Y/%m/%d/secure-access.log" combined

        #RewriteLogLevel 1
        #RewriteLog "|/usr/bin/cronolog /home/www/confluence.example.com/logs/%Y/%m/%d/secure-rewrite.log"


        # SSL
        #
        SSLEngine on

        SSLCertificateFile      "...crt"
        SSLCertificateKeyFile   "...key"
        SSLCertificateChainFile "...ca-bundle"

        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

</VirtualHost>

おすすめ記事