Server1 runs apache proxy and webserver tomcat domain: example.com/app1. Server2 runs just webserver tomcat example.com/app2. I'd like to redirect example.com/ to example.com/app1 and app2 server not redirect just stay on example.com/app2. Also need redirection all pages from http to https. Some things doesnt comunicate properly between app1 and app2 servers - I see error 500.

**hhtpd.conf on Server1:**
    Listen 80
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    RedirectMatch "^/$" "https://example.com/app1/"
**ssl.conf on Server1:**
<VirtualHost *:443>
    ServerName example.com
    SSLEngine on
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    <Proxy *>
            Require all granted
    SSLProxyEngine          On
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /app1       http://localhost:8080/app1
    ProxyPassReverse        /app1       http://localhost:8080/app1
    ProxyPass               /app2
    ProxyPassReverse        /app2

Can I use RewriteEngine with reverse proxy?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.