[ACCEPTED]-Retain original request URL on mod_proxy redirect-mod-proxy
If you're running Apache >= 2.0.31 then 8 you might try to set the ProxyPreserveHost
directive as described 7 here.
This should pass the original Host header 6 trough mod_proxy into your application, and 5 normally the request URL will be rebuild 4 there (in your Servlet container) using 3 the Host header, so the schema location 2 should be build using the host and path 1 infos from "before" the proxy.
(Posted here too for the sake of completeness)
Here is another alternative if you would 9 like to retain both the original host name 8 and the proxied host name.
If you are using 7 mod_proxy disable ProxyPreserveHost
in the Apache configuration. For 6 most proxy servers, including mod_proxy, read 5 the X-Forwarded-Host
header in your application. This identifies 4 the original Host header provided by the 3 HTTP request.
You can read about the headers 2 mod_proxy (and possible other standard proxy 1 servers) set here:
You should be able to do a mod_rewrite in 11 apache to encode the full URL as a query 10 parameter, or perhaps part of the fragment. How 9 easy this might be depends on whether you 8 might use one or the other as part of your 7 incoming queries.
For example, http://external.foo.bar/MyApplication
might get 6 rewritten to http://external.foo.bar/MyApplication#rewritemagic=http://external.foo.bar/MyApplication
which then gets passed into 5 the ProxyPass and then stripped out.
A bit 4 of a hack, yes, and perhaps a little tricky 3 to get rewrite and proxy to work in the 2 right order and not interfere with each 1 other, but it seems like it should work.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.