Httpd mod proxy Installation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
m (Ovidiu moved page Httpd Proxying and Load Balancing Configuration to Httpd mod proxy Installation without leaving a redirect)
(No difference)

Revision as of 17:41, 5 January 2017

Internal

Overview

This article decribes mod_proxy installation. For concepts, see "mod_proxy Concepts". For configuration reference, see "".

Load the Modules

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

For a list of required modules and an explanation of how they work together, see "mod_proxy Modules and How they Work Together" section.

Declare the Balancer Worker

ProxyPass / balancer://mycluster/ stickysessions=jsessionid|JSESSIONID nofailover=On

Trailing Slash


The trailing slash on the balancer URL (in this case "balancer://mycluster/") is important so that the URLs are properly resolved while being proxied. Note that without a training slash, if the "/example" is requested, the URL will become "balancer://myclusterexample". No such balancer exists, and the request will fail with a 500 response. With the trailing slash, it'd resolve as "balancer://mycluster/example", which will allow to correctly locate the balancer.

Prevent Proxying for Certain URLs

In order to prevent proxying for certain URLs, additional ProxyPass directives can be specified as follows:

ProxyPass /this-wont-be-proxied !

ProxyPass and ProxyPassMatch rules are checked in the order in which they were specified in the configuration file, and the first rule match wins. That is why the declaration of the URLs for which we want to prevent proxying should be specified at the top of the list. For more details on ProxyPass processing order see:

ProxyPass Processing Order


ProxyPassReverse

TODO httpd ProxyPassReverse

Specify the Balancer Topology and Configuration

<Proxy balancer://mycluster>
    BalancerMember http://my-node1:port1/ route=node1
    BalancerMember http://my-node2:port2/ route=node2
</Proxy>