Chapter 11: Tomcat and Apache HTTP Server ProxyPass

Chapter 11: Tomcat and Apache HTTP Server ProxyPass /examples/jsp ajp://192.168.23.228:8009/examples/jsp ProxyPassReverse /examples/jsp ajp://192.168.23.228:8009/examples/jsp Order allow,deny Allow from all The first directive, ProxyRequestsOff, turns off forward proxying. This is essentially turning off the forwarding capabilities of mod_proxy, except for the specific mappings that you will be specifying with ProxyPassand ProxyPassReversedirectives. The ProxyPreserveHost directive tells mod_proxy to pass the requested host information from the original request to the AJP connection. This is useful for applications that have a dependency on the requested host. This directive is not available for the 1.3. x series of Apache Web servers. The section specifies the access rules using standard Apache configuration syntax. In this case, all incoming hosts can access the proxy. In production, you may want to restrict the set of allowed hosts that can access the proxy. See Apache Web server documentation on the syntax. The ProxyPass directive specifies that requests for the /examples/jspURI should be sent to localhost:8009/examples/jsp, and requests should be sent using AJP protocol. Of course, the Tomcat server instance is already set to listen at this port via the Tomcat AJP Connector. The ProxyPassReverse directive is an essential accompanying directive when configuring AJP proxy to Tomcat. This directive specifies that headers of reverse proxy requests should be rewritten appropriately. This ensures that any redirections from the Tomcat server are handled correctly. The section is a standard Apache Web server section for specifying URI access permissions. In this case, the section ensures that the proxied URI /examples/jspis accessible to all. Testing the mod_proxy Setup This section tests a working Apache server to Tomcat server setup, connected via AJP 1.3 and mod_ proxy. Confirm that you are using Apache 2.2. x and that the binary mod_proxy.sois located under the modulesdirectory. You need to make sure the following lines are uncommented in your httpd.conf. LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so Also in the httpd.conffile, add the following to the main configuration section (see comments in the Apache Web server s httpd.conffile to locate the main section). ProxyRequests Off ProxyPreserveHost On Order deny,allow Allow from all

For reliable and cheap web hosting services please check javaweb hosting website.

Comments are closed.