I'd like to proxy
http://example.com/public/ to the outside world. Here is my configuration:
RewriteEngine On # Append a slash if necessary RewriteRule ^/public$ public/ [R,L] # Request headers: Replace http://localhost:1006/ with http://example.com/public/ ProxyPass /public/ http://localhost:1006/ # Response headers: Replace http://example.com/ with http://example.com/public/ ProxyPassReverse /public/ http://example.com/ ProxyPassReverseCookiePath / /public/ <Location /public> Require all granted </Location>
This works well for rewriting headers, but the server still thinks its context path is
/ instead of
/public/ so when it constructs URLs for embedding into JSON they are incorrect. Httpd only rewrites headers, not the JSON, so it does nothing about this.
I don't want httpd to rewrite the JSON (I read the process is unreliable). I noticed that the
Host header sent by httpd to the server contains the external hostname, which enables the server to correct that part of the URL. Is there some other header I could set which would instruct the server to use a different context-path?
Meaning, is there anything I can do on httpd which would alter the server's context-path without altering the server's configuration/code directly?