0

I have a proxy setup on an Apache 2.4 (Server A) as follows

SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On
ProxyHTMLInterp On
ProxyHTMLExtended On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
<Location /proxy>
    ProxyPass https://example.com
    ProxyPassReverse https://example.com
    SetOutputFilter proxy-html
    ProxyHTMLURLMap https://example.com
</Location>

Server B (example.com in this example) has a rewrite rule:

RewriteRule ^/?$ /subdir [L]

When I browse to https://servera.com/proxy the url changes to https://servera.com/subdir which throws a 404 error. If I change the url to https://servera.com/proxy/subdir everything works.

My question is how can I setup Server A's proxy to preserve the /proxy in the url?

2
  • Could you rewrite it before passing it to mod_proxy? – Esa Jokinen Jul 5 '18 at 17:52
  • The RewriteRule is on Server B. Server A won't know what rewrite rules Server B has...or will have in the future. I just want ALL of the content from Server B to be proxied to Server A at servera.com/proxy* – mminnie Jul 5 '18 at 18:24
0

Try adding / like in the ProxyPass examples.

<Location /proxy/>
    ProxyPass https://example.com/
    ProxyPassReverse https://example.com/
    SetOutputFilter proxy-html
    ProxyHTMLURLMap https://example.com/
</Location>

It might help in this case where the site behind the proxy redirects to an absolute path on the same hostname.

1
  • I tried adding a trailing slash without success. – mminnie Jul 6 '18 at 3:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.