Application Layer Switching Module for Apache
1.1. <L7Pool>
1.2. L7PoolMember
1.3. L7PersistMethod
1.3.1. cookie-insert
1.3.2. source-address
1.4. L7BalancingMethod
1.4.1. round-robin
1.4.2. weighted-round-robin
1.4.3. fastest-response-times
1.4.4. request-uri-hashing
1.4.5. random
1.5. L7RedirectRewrite
1.6. L7CookieRewrite
1.7. L7PoolMonitor
1.7.1. http
1.7.2. icmp
1.8. L7DefaultPool
1.9. L7PerlScript
1.10. L7PerlInclude
1.11. L7EventFunction
1.11.1. ON_REQUEST
1.11.2. ON_REQUEST_DATA
1.11.3. ON_RESPONSE
1.11.4. ON_RESPONSE_DATA
1.11.5. ON_LBFAILURE
2. Examples
This section document contains list of supported configuration directives.
NOTE: This module requires services of mod_proxy (mod_proxy_http, mod_proxy_ajp, ..) for reverse proxy operations. Thus, in order to operate properly mod_proxy and mod_proxy_http have to be present in the server. See configuration examples.
|
Description: | Specify a load balancing pool with name poolname |
---|---|
Syntax: | <L7Pool poolname> ... </L7Pool> |
Context: | Server configuration |
Default value: | none |
Status: | Available since version 0.1.0 |
Description: | Specify a pool member and it's attributes for this load balancing pool |
---|---|
Syntax: | L7PoolMember url [key=value] ... |
Context: | Within L7Pool directive |
Default value: | none |
Status: | Available since version 0.1.0 |
As mod_layer7 uses mod_proxy for reverse-proxy operations you can configure pool members using AJP13,FTP,CONNECT or HTTP protocols. Just remember to load and configure required mod_proxy_ajp, mod_proxy_http, etc.. modules properly. See mod_proxy documentation for more details.
If you use balancer pools then persistence and load balancing decisions are handled by mod_proxy_balancer.
Currently only http pools have been used/tested. Other pool types might not work properly (or at all).
Description: | Specify a persistency method and related attributes to this load balancing pool |
---|---|
Syntax: | L7PersistMethod method-name [key=value] ... |
Context: | Within L7Pool directive |
Default value: | none |
Status: | Available since version 0.1.0 |
Description: | Specify a load balancing method for this load balancing pool |
---|---|
Syntax: | L7BalancingMethod method-name [key=value] ... |
Context: | Within L7Pool directive |
Default value: | round-robin |
Status: | Available since version 0.1.0 |
Description: | Specify HTTP redirect rewrite behaviour for this load balancing pool |
---|---|
Syntax: | L7RedirectRewrite mode [key=value] ... |
Context: | Within L7Pool directive |
Default value: | none |
Status: | Available since version 0.1.0 |
Description: | Specify HTTP Cookie name rewriting behaviour for this load balancing pool |
---|---|
Syntax: | L7CookieRewrite clientside serverside [key=value] ... |
Context: | Within L7Pool directive |
Default value: | none |
Status: | Available since version 0.1.0 |
Description: | Specify pool monitor configuration for pool members |
---|---|
Syntax: | L7PoolMonitor monitor-name [key=value] ... |
Context: | Within L7Pool directive |
Default value: | round-robin |
Status: | Available since version 0.1.0 |
L7PoolMonitor directive can be used for associating pool monitoring configurations with configured pool members.


Description: | Specify default pool to be used for processing requests |
---|---|
Syntax: | L7DefaultPool pool-name |
Context: | Within L7Pool directive |
Default value: | first configured L7Pool |
Status: | Available since version 0.1.0 |
...
Description: | Specify perl script file that contains L7EventFunction definitions. |
---|---|
Syntax: | L7PerlScript filename |
Context: | Within L7Pool directive |
Default value: | none |
Status: | Available since version 0.1.0 |
Specify the script file from where the event functions are loaded.
Description: | Specify additional Perl include path |
---|---|
Syntax: | L7PerlInclude /path/to/perl/modules |
Context: | Within L7Pool directive |
Default value: | none |
Status: | Available since version 0.1.0 |
With this directive you can specify additional Perl include pages if you have some own Perl modules you want to use in L7PerlScript containing L7EventFunction definitions.
Description: | Specify perl sub-routine for different events |
---|---|
Syntax: | L7EventFunction event routine-name |
Context: | Within L7Pool directive |
Default value: | none |
Status: | Available since version 0.1.0 |
Define the sub-routine to be called during different steps of request processing cycle. See L7PerlScript for more information on how to load event functions/sub-routines...
...
...
...
...
...
Example configuration with:
- L7Pool with name dynamic-pool
- pool has 3 L7PoolMembers using mod_proxy_ajp / AJP13 protocol
- L7BalancingMethod is set to round-robin
- L7PersistMethod is set to cookie-insert
- L7Pool with name static-pool
- pool has 2 L7PoolMembers using mod_proxy_http / HTTP protocol
- pool is using default L7BalancingMethod
- pool is not using persistence
- L7DefaultPool is set to dynamic-pool, thus all requests will go to this pool by default
- L7PerlScript is set to example1.pl control scripts file
# load mod_proxy module(s) required for reverse proxy operations.. LoadModule proxy_module /opt/local/apache/2.2.15+dso/modules/mod_proxy.so LoadModule proxy_module_http /opt/local/apache/2.2.15+dso/modules/mod_proxy_http.so LoadModule proxy_module_ajp /opt/local/apache/2.2.15+dso/modules/mod_proxy_ajp.so # load mod_layer7 module LoadModule layer7_module /opt/local/mod_layer7/0.1.0/modules/libmod_layer7.so # Pool for web-application (tomcat) # # NOTE: first defined pool is default pool # use L7DefaultPool to override/explicitely define default pool <L7Pool "dynamic-pool"> L7PoolMember "ajp://10.0.0.12:5090" ratio=1.0 L7PoolMember "ajp://10.0.0.13:5090" ratio=1.0 L7PoolMember "ajp://10.0.0.14:5090" ratio=0.5 L7BalancingMethod "round-robin" L7PersistMethod "cookie-insert" </L7Pool> # pool of normal HTTP servers for static content # (eg. images, css files, ...) <L7Pool "static-pool"> L7PoolMember "http://10.0.0.20" ratio=1.2 L7PoolMember "http://10.0.0.21" ratio=1.0 </L7Pool> # You could also use mod_proxy_balancer pools # # <L7Pool "balancer-pool"> # L7PoolMember "balancer://mycluster" # </L7Pool> # # <Proxy balancer://mycluster> # BalancerMember http://192.168.1.50:80 # BalancerMember http://192.168.1.51:80 # </Proxy> # L7DefaultPool "dynamic-pool" L7PerlScript "example1.pl" # define sub-routine names to be called on different # events during HTTP request processing cycle. # L7EventFunction ON_REQUEST on_request L7EventFunction ON_RESPONSE on_response L7EventFunction ON_LBFAILURE on_lbfailure # L7EventFunction ON_STARTUP on_startup # L7EventFunction ON_SHUTDOWN on_shutdown