** updated with workaround at bottom of this answer **
I have a requirement for my webapp to proxy to 2 external reporting servers.
So I will have a menu-item for each external reporting server.
But the browser-URL has too look like it's my server so I can't just redirect.
these servers both have the same context-root /ibm
For both servers browser-URL should look like http://example.com/ibm.. while the apache proxies to the correct one.
How should a setup like this be done?
How can Apache know to which one it has to proxy?
I wouldn't mine if I had to do some change so the URL's would turn out like :
http://example.com/rep1/ibm and http://example.com/rep2/ibm
I managed to have the desired effect using my weblogic-proxy servlet and manipulating URL's etc, but Apache would be a more efficient solution if this can be done somehow.
I appreciate any input.
Also the inital request to the external reporting servers is launched from my webapp, not from the browser.
** update **
We now have to proxy to about 10 other webservers, where some had this issue. But whenever the target webserver was deployed in the root we also had to rewrite the body etc.. which for some of these proxy-integrations was a lot of trial and error.
Workaround Solution: we have switched to sub-domains for these proxied webservers, where actualy the subdomain URL's still point to our own apache, but using these subdomain-names we can more easily set up a virtual host & proxy in our Apache config, and we don't have to rewrite any of the response bodies etc.
Best Answer
This is easily done with
mod_proxy
:There is more information at the apache documentation site for mod_proxy.
If you need to change the links in the content returned from the external sites, you can do that using mod_ext_filter. Here's a sample configuration to rewrite a link: