Hi, there. I have apache web server installed as frontend and I have j2ee SAP Netweaver Application Server installed in Intranet server. How can I configure apache to forward requests and response to/from j2ee app server. for example, external apache server's ip is 9.20.1.1:80. internal sap server's address is 192.168.0.1/sap/bc/gui/sap/its/webgui?sap_client=200 i wand access to my sap app server for example 9.20.1.1/sapserver/sap/bc/gui/sap/its/webgui?sap_client=200
views:
1532answers:
3Assuming you have mod_proxy enabled, add to you're sites-available:
ProxyRequests Off
<Location "/sapserver">
ProxyPass http://192.168.0.1
ProxyPassReverse http://192.168.0.1
</Location>
Be careful though as this does expose your internal site to the entire internet.
This is often mistakenly referred to as a reverse proxy. If you use a search engine to find "reverse proxy apache" you will get many good results.
The quick answer is to add something like this to your apache.conf
ProxyPass /sap/ 192.168.0.1/sap/
< Location /sap/ >
ProxyPassReverse /sap/
< /Location >
See also the modrewrite rools and the [P] option.
You mentioned load balancing- so presumably you want to be able to add more Application Servers that are served through a single address. I hope they are stateless or storing session information in a database. You can use Apache to serve as a reverse proxy load balancer with mod_proxy_balancer
. Docs are here.
Here's an example of what to add to your httpd.conf from this link.
<Proxy balancer://myclustername>
# cluster member 1
BalancerMember http://192.168.0.1:3000
BalancerMember http://192.168.0.1:3001
# cluster member 2, the fastest machine so double the load
BalancerMember http://192.168.0.11:3000 loadfactor=2
BalancerMember http://192.168.0.11:3001 loadfactor=2
# cluster member 3
BalancerMember http://192.168.0.12:3000
BalancerMember http://192.168.0.12:3001
# cluster member 4
BalancerMember http://192.168.0.13:3000
BalancerMember http://192.168.0.13:3001
</Proxy>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.meinprof.de
ServerAlias meinprof.de
ProxyPass / balancer://meinprofcluster/
ProxyPassReverse / balancer://meinprofcluster/
ErrorLog /var/log/www/www.meinprof.de/apache_error_log
CustomLog /var/log/www/www.meinprof.de/apache_access_log combined
</VirtualHost>