#
Configure Apache Proxy
Configure an Apache Server to act as a Proxy (Configure Apache Proxy). My example is done on a Linux machine
If you want to make a configuration change for the Apache Server (a free HTTP Server) you have to change
the httpd.conf
file (the main configuration file of an Apache Server). This file is located
at $APACHE_HOME/conf
directory.
Here is an example (this code was added to the end of the httpd.conf file):
<VirtualHost *:80>
ProxyRequests On
ProxyPreserveHost On
ServerName servername1
#ErrorLog ${APACHE_LOG_DIR}/error.log
#CustomLog ${APACHE_LOG_DIR}/access.log combined
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel error
<Location /console>
ProxyPass "http://192.168.10.122:7001/console/"
ProxyPassReverse "http://192.168.10.122:7001/console/"
Order allow,deny
Allow from all
</Location>
<Location /MyApp1>
ProxyPass "http://192.168.10.122:7009/MyApp1/"
ProxyPassReverse "http://192.168.10.122:7009/MyApp1/"
Order allow,deny
Allow from all
</Location>
<Location /MyApp1/login>
ProxyPass "http://192.168.10.122:7009/MyApp1/login"
ProxyPassReverse "http://192.168.10.122:7009/MyApp1/login"
Order allow,deny
Allow from all
</Location>
</VirtualHost>
In this case (supposing your HTTP Apache Server is installed on a host named MyApplications):
the requests on
MyApplications:80
you will get the "index" page of that HTTP Server. This is a normal behaviour.the requests on
MyApplications:80/console
you will get the page from thehttp://192.168.10.122:7001/console/
(in my case this is a link to the WebLogic Administration Console)the requests on
MyApplications:80/MyApp1
you will get the page from thehttp://192.168.10.122:7009/MyApp1
(in my case this is a link to an application running on an WebLogic Administration Console)
Using the ProxyPassReverse & ProxyPass, in the browser you will not see a URL rewrite, so you will still see your first URL (MyApplications:80/console for instance), but the content will be from the http://192.168.10.122:7001/console
In this case, the Apache HTTP Server will act as a Proxy for the URL requests.