Apache HTTP Server

Apache HTTP Server is one of the most widely used WEB servers. It makes it easy to expose URLs via HTTP(s).

This section describes a few typical configurations, which can be adapted to suit the context.

Minimum configuration

<VirtualHost *:80>
	ServerName www.flowerdocs.com                                                           
	ServerAlias flowerdocs.com *.flowerdocs.com                                             
	                                                                                                                                                                                      
	<Location /gui >                                                         
	    ProxyPass http://localhost:8080/gui
	    ProxyPassReverse http://localhost:8080/gui
	</Location>
	                                                                                        
	<Location /flower-docs-arender >
	    ProxyPass http://localhost:8080/flower-docs-arender
	    ProxyPassReverse http://localhost:8080/flower-docs-arender
	</Location>
	
	<Location /core >
	    ProxyPass http://localhost:8081/core
	    ProxyPassReverse http://localhost:8081/core
	</Location>
	                                                                                        
	ErrorLog ${APACHE_LOG_DIR}/flower-error.log
	CustomLog ${APACHE_LOG_DIR}/flower-access.log combined
</VirtualHost>

Rewriting

If the access path to FlowerDocs changes, it is necessary to modify some HTTP headers for the GUI.

To do this, use the error code to add the following directives:

	<Location /ui >
	    Header edit Set-Cookie "^(.*; [p|P]ath=)(.*)" "$1/ui"                          
	    RequestHeader edit X-GWT-Module-Base ^(.*)/gui/(.*)$ $1/ui/$2
    </Location>                  

Load balancing

Apache HTTP Server makes it easy to set up application load balancing.

In the example below, roundrobin balancing is set up for FlowerDocs Core applications and session affinity balancing for FlowerDocs GUI applications.

<VirtualHost *:80>
	Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
	
	<Proxy "balancer://core-cluster">
	    BalancerMember "http://192.168.1.50:8080/core"
	    BalancerMember "http://192.168.1.51:8080/core"
	</Proxy>
	ProxyPass        "/core" "balancer://core-cluster"
	ProxyPassReverse "/core" "balancer://core-cluster"
	
	
	<Proxy "balancer://gui-cluster">
	    BalancerMember "http://192.168.1.52:8080/gui" route=1
	    BalancerMember "http://192.168.1.53:8080/gui" route=2
	    ProxySet stickysession=ROUTEID
	</Proxy>
	ProxyPass        "/gui" "balancer://gui-cluster"
	ProxyPassReverse "/gui" "balancer://gui-cluster"

	ErrorLog ${APACHE_LOG_DIR}/flower-cluster-error.log
	CustomLog ${APACHE_LOG_DIR}/flower-cluster-access.log combined
</VirtualHost>