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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s