Httpd mod proxy Installation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[httpd mod_proxy|mod_proxy]]
* [[httpd mod_proxy|mod_proxy]]
=TODO=
{{Error|Left in an intermediate state, re-process and finish next time I need it}}


=Overview=
=Overview=
Line 26: Line 30:
{{Internal|Httpd_mod_proxy_Concepts#Direct_Workers|Direct Workers}}
{{Internal|Httpd_mod_proxy_Concepts#Direct_Workers|Direct Workers}}


Direct workers proxy to just one backend node.  
Direct workers proxy to just one backend node. <font color=darkgray>This section is not finished yet. Come up with the example when I need it.</font>
 
<font color=red>Come up with the example when I need it.</font>


==Balancer Worker==
==Balancer Worker==
Line 34: Line 36:
{{Internal|Httpd_mod_proxy_Concepts#Balancer_Workers|Balancer Worker}}
{{Internal|Httpd_mod_proxy_Concepts#Balancer_Workers|Balancer Worker}}


Balancer workers proxy to a pool of load-balanced backend node.
Balancer workers proxy to a pool of load-balanced backend node:
 
<pre>
ProxyPass / balancer://mycluster/
</pre>


===Trailing Slash===
===Trailing Slash===
<font color=red>Verify this:</font>


<blockquote style="background-color: Gold; border: solid thin Goldenrod;">
<blockquote style="background-color: Gold; border: solid thin Goldenrod;">
:<br>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.<br><br>
:<br>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.<br><br>
</blockquote>
</blockquote>
===Load Balancing Pool Declaration===
<pre>
<Proxy balancer://mycluster>
    BalancerMember http://my-node1:port1/
    BalancerMember http://my-node2:port2/
</Proxy>
</pre>
<font color=red>Use "route"</font>


=Prevent Proxying for Certain URLs=
=Prevent Proxying for Certain URLs=
Line 55: Line 75:
:[[Httpd_ProxyPass#Order|ProxyPass Processing Order]]
:[[Httpd_ProxyPass#Order|ProxyPass Processing Order]]
</blockquote>
</blockquote>


=ProxyPassReverse=
=ProxyPassReverse=


<font color=red>TODO [[httpd ProxyPassReverse]]</font>
<font color=red>TODO [[httpd ProxyPassReverse]]</font>
=Specify the Balancer Topology and Configuration=
<pre>
<Proxy balancer://mycluster>
    BalancerMember http://my-node1:port1/ route=node1
    BalancerMember http://my-node2:port2/ route=node2
</Proxy>
</pre>

Latest revision as of 17:46, 10 January 2017

Internal

TODO


Left in an intermediate state, re-process and finish next time I need it

Overview

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

Load the Modules

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

Note that the modules must be compiled as dynamic modules and available. For more details on dynamic modules, see Static Modules vs. Dynamic Modules.

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

Declare the Proxy Worker

Direct Worker

Direct Workers

Direct workers proxy to just one backend node. This section is not finished yet. Come up with the example when I need it.

Balancer Worker

Balancer Worker

Balancer workers proxy to a pool of load-balanced backend node:

ProxyPass / balancer://mycluster/

Trailing Slash

Verify this:


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.

Load Balancing Pool Declaration

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


Use "route"

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