Get your Local Web Application to pull data from a Remote Server

apache
Standard

Sometimes when you have a web application deployed to your local host it is more convenient to get the data for it from a remote host. Add the following to the end of your apache2\conf\httpd.conf to redirect all requests for the localhost/ws endpoint to a remote one (will require an Apache restart).

# Pull data from another host instead of localhost.
SSLProxyEngine On
ProxyPass /ws https://remote.host/ws
ProxyPassReverse /ws https://remote.host/ws

Note: SSLProxyEngine allows this to work with HTTPS URLs.

If you want to exclude a request from being redirected to the remote host, and instead to get data from your local machine add the following:

ProxyPass /ws/myservice/person !

If you are using Tomcat or JBoss with jk_mod you may also need to add the following to allow the resource to be serviced locally:

JkUnMount /ws/myservice/person ajp13