TransWikia.com

Redirect to URI with Apache2 as Reverse Proxy

Super User Asked by LeRouteur on November 3, 2021

I’m running a Reverse Proxy using Apache2, and I have the following vHost configured :

<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>

When a client connects to http://rds.example.com or https://rds.example.com, I want to redirect him to https.//rds.example.com/RDWeb (the default Remote Desktop Web Services of Microsoft).

Actually, when a client connects, he is only redirected to https://rds.example.com with the beautiful IIS page.

What am I doing wrong ?

One Answer

You can use mod_rewrite to redirect to where you want - integrate this in the SSL vhost:

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

Don't forget to enable mod_rewrite (use a2enmod if at all possible).

Answered by fratester on November 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP