Apache2 をリバースプロキシとして使用して URI にリダイレクトする

Apache2 をリバースプロキシとして使用して URI にリダイレクトする

私は Apache2 を使用してリバース プロキシを実行しており、次の vHost を構成しています。

<VirtualHost *:80>
        ServerName rds.example.com
        Redirect / https://rds.example.com/RDWeb/
</VirtualHost>
<VirtualHost *:443>
        # Proxy
        ServerName rds.example.com
        ProxyPreserveHost on
        SSLProxyEngine on
        SSLProxyVerify off
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerName off
        SSLProxyCheckPeerExpire off
        ProxyPass / https://backend01.example.com/
        ProxyPassReverse / https://backend01.example.com/
SSLCertificateFile /etc/letsencrypt/live/rds.example.com//fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/rds.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

クライアントが接続するとhttp://rds.example.comまたはhttps://rds.example.com、https.//rds.example.com/RDWeb (Microsoft のデフォルトのリモート デスクトップ Web サービス) にリダイレクトします。

実際、クライアントが接続すると、リダイレクトされるのはhttps://rds.example.com美しい IIS ページとともに。

何が間違っているのでしょうか?

答え1

必要な場所にリダイレクトするにはmod_rewrite、これを SSL vhost に統合します。

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .* /RDWeb/ [R,L]

mod_rewrite を有効にすることを忘れないでください (a2enmod可能な場合は使用してください)。

関連情報