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? Commented Jul 5, 2018 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* Commented Jul 5, 2018 at 18:24

1 Answer 1

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. Commented Jul 6, 2018 at 3:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.