Child pages
  • Configure Apache HTTPd as a reverse proxy (mod_proxy)
Skip to end of metadata
Go to start of metadata

This is the simplest way to re-route requests from the Apache HTTPd to the Geronimo servers (or any other server you might have). To use this feature, you need to enable some specific modules and add a few lines to the HTTPd configuration. These steps are described as follows:

  1. Open the httpd.conf file located in the <httpd_home>\conf directory.
  2. Look for the following LoadModule directives and uncomment them by removing the # at the beginning of the line.
    LoadModule proxy_module modules/
    LoadModule proxy_http_module modules/
  3. At the bottom of the httpd.conf file, add the following lines to enable the re-routing.
    ProxyPass /console http://localhost:8080/console
    ProxyPass /images http://localhost:8080/images
    ProxyPassreverse / http://localhost:8080/

You might need to add more ProxyPass directives depending on the requirements of your application. The last ProxyPassreverse directive captures the responses from the Geronimo server and masks the URL as it would be directly responded by the Apache HTTPd, hiding the identity or location of the Geronimo server.

In this example, the console has been enabled just for demonstration purposes. In a production environment, you do not want to have the console accessible from the other network (normally the Internet). Having the console accessible represents a big security exposure.

The rule is that everything should have restricted access. Normally, a firewall would be placed in between the HTTP and the application server (depending on the topology) and you should map just the minimum resources necessary to have your application working from the other side.

If both HTTPd and Geronimo servers are on the same machine, you can use localhost for the redirection. When the servers are located on different machines, you would have to specify the URL for the Geronimo server.

As the result of this configuration, when you point your browser to http://locahost/console, the request will be redirected to http://localhost:8080/console. This option allows you to re-route URLs and ports.

Note: If you prefer to use mod_proxy_ajp rather than mod_proxy_http, you need to load proxy_ajp_module in httpd.conf and change the routing port to 8009(default) as follows:

LoadModule proxy_module modules/
LoadModule proxy_ajp_module modules/
ProxyPass /console ajp://localhost:8009/console
ProxyPass /images ajp://localhost:8009/images
ProxyPassreverse / ajp://localhost:8009/
  • No labels