mod_proxy is implemented as a set of Apache modules. mod_proxy allows the front-end Apache web server to communicate with the JBoss application server(s) that host the EKM server application. Additional documentation can be found on the Apache website:
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
To configure Apache mod_proxy, perform the following steps. Depending on the installation option you chose, some of these steps may require configuration changes, or they may only require verification of the existing configuration.
In the Apache configuration file APACHE_HOME/conf/httpd.conf,
configure or verify the configuration of the following modules:
Apache v2.4.x:
LoadModule headers_module modules/mod_headers.so LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so LoadModule rewrite_module modules/mod_rewrite.so 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 slotmem_shm_module modules/mod_slotmem_shm.so LoadModule ssl_module modules/mod_ssl.so LoadModul proxy_wstunnel_module modules/mod_proxy_wstunnel.so
Configure, or verify the configuration of Apache.
In the Apache configuration file: APACHE_HOME/conf/httpd.conf
Configure the Listen directive to control which IP address(es) and port(s) the web server will listen on:
Listen 80
Configure the ProxyTimeout directive to determine how
long the mod_proxy load balancer in the front-end Apache web server will listen for
a response from a JBoss node. If not set, a default value of 300 seconds (5 minutes)
is used. This may be too short for some operations such as large file transfers. In
the example below, the timeout is set to 1800 seconds (30 minutes).
ProxyTimeout 1800
In the Apache configuration file: APACHE_HOME/conf/httpd.conf, configure the ProxyPreserveHost directive:
ProxyPreserveHost on
Configure the mod_proxy_balancers:
First, the following line is needed to enable sticky sessions and must be added:
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"
env=BALANCER_ROUTE_CHANGEDThe server names that have the running instances of EKM need to be added to the httpd.conf file and defined as one balancer (replace “ekmservername” with the actual server names):
<Proxy balancer://ekmbalancer>
BalancerMember http://ekmservername:8080 loadfactor=50 route=node1 retry=60
BalancerMember http://ekmservername2:9080 loadfactor=50 route=node2 retry=60
ProxySet stickysession=ROUTEID
ProxySet lbmethod=byrequests
</Proxy>"ekmbalancer" is the name of the balancer which comprises all EKM servers.
"ekmservername" represents the server name and port that EKM is installed on.
Note: Any name can be used for the balancer.
A web socket balancer also needs to be created for the web sockets used by EKM:
<Proxy balancer://websocketbalancer>
BalancerMember ws://ekmservername:8080 loadfactor=50 route=node1
BalancerMember ws://ekmservername:9080 loadfactor=50 route=node2
ProxySet stickysession=ROUTEID
ProxySet lbmethod=byrequests
</Proxy>"websocketbalancer" is the name of the balancer that comprises all the web sockets used by EKM.
"ekmservername" represents the server name and port that EKM is installed on.
Note: Any name can be used for the balancer.
The following configurations parameters are used in the above proxy configurations and a more in depth description can be found in the Apache documentation (link listed above).
Configuration Parameters
This is the member load factor - a number between 1 (default) and 100, which defines the weighted load to be applied to the member in question. In the case above the load is distributed 50-50, which means that if node1 starts a session, then the next EKM Session will be on node 2. It is not based on http requests but EKM user sessions.
Value of the worker when used inside load balancer. The route is a value appended to session id.
The value is usually set to something like JSESSIONID, and it depends on the backend application server that support sessions. If the backend application server uses different names for cookies and url encoded id (like servlet containers), use to separate them. The first part is for the cookie; the second for the path. A method used with Application Load Balancing, to achieve server-affinity. A router or load balancer with sticky-session support can assign a single server to a particular user, based on their HTTP session or IP address. In this case the ROUTEID which is added in the cookie is used.
ProxySet stickysession=ROUTEID
Select the load-balancing scheduler method to use. Either byrequests, to perform weighted request counting; bytraffic, to perform weighted traffic byte count balancing; or bybusyness (Apache HTTP Server 2.2.10 and later), to perform pending request balancing. The default is byrequests.
Connection pool worker retry timeout in seconds. If the connection pool worker to the backend server is in the error state, Apache will not forward any requests to that server until the timeout expires. This enables to shut down the backend server for maintenance and bring it back online later. A value of 0 means always retry workers in an error state with no timeout.
Configure a Virtual Host:
Configure the Virtual Host, or create a new Virtual Host to handle connections to the front-end webserver on the desired port. For example:
<VirtualHost 192.168.1.2:80>
ServerName ekm.yourdomain.com
ProxyRequests off
ProxyPreserveHost On
ProxyPass /ekm/websocket-upload balancer://websocketbalancer/ekm/websocket-upload
ProxyPassReverse /ekm/websocket-upload balancer://websocketbalancer/ekm/websocket-upload
ProxyPass /ekm/__richfaces_push balancer://websocketbalancer/ekm/__richfaces_push
ProxyPassReverse /ekm/__richfaces_push balancer://websocketbalancer/ekm/__richfaces_push
ProxyPass / balancer://ekmbalancer/ stickysession=JSESSIONID
ProxyPassReverse / balancer://ekmbalancer
</VirtualHost> Replace the “192.168.1.2:80” with the IP of the server apache is on.
All proxypasses and proxypassreverse statements must be added in the above order.
Grant or restrict access to the EKM location. In the case below all access is granted because to log into EKM the user must authenticate. It can be limited to groups of IPs or server names. See apache documentation for more detail.
<Location /ekm> Require all granted </Location>
The balance manager application allows administrators to see statistics of how the load is being distributed. Access can be controlled using the Require directive.
<Location /balancer-manager> SetHandler balancer-manager Require all granted </Location>
Note: Some firewalls and security products may process or alter traffic whose destination port is port 80 (HTTP) in ways that may cause EKM to function incorrectly. If you decide to configure the EKM server, or a front-end web server, to listen on port 80 and experience difficulties using the EKM server, it may be necessary to configure the EKM server or front-end web server to use another port such as 8080.