﻿# HAProxy configuration for BRIX web

> [HTML Version](haproxy-web-elma365.html)

The architecture of a highly available BRIX cluster involves the interaction of BRIX application microservices within a resilient cluster. To evenly balance traffic between Kubernetes cluster servers, install a HAProxy configuration. This will ensure stable system operation in case of a failure.

## Example HAProxy configuration for BRIX web

This article presents a HAProxy configuration that balances client connections coming to \[OBJECT\] between Kubernetes cluster servers.

In order to create a HAProxy configuration for BRIX web, perform the following actions:

1. Open the \[OBJECT\] configuration file for editing using the following command:

````
sudo nano /etc/haproxy/haproxy.cfg

2. ````
Edit the \[OBJECT\] configuration file:

Configuration example:

````
\### Web BRIX365 ###  
listen brix365\_web  
    bind haproxy-server.your\_domain:80  
    mode http  
    balance leastconn  
    no option http-use-htx  
    # http-use-htx is deprecated and ignored since Haproxy 2.1  
    option forwardfor  
    option httpclose  
    server brix365-1 brix365-1.your\_domain:80 check  
    server brix365-2 brix365-2.your\_domain:80 check  
    server brix365-3 brix365-3.your\_domain:80 check  
\### Web BRIX365 ###
````

````
Example of a HAProxy configuration using SSL

SSL can be enabled if OpenSSL support is embedded. In the \[OBJECT\] parameter, specify the path to the PEM file containing the required certificates and associated private keys ([fullchain certificate](fullchain-sertificate.md)). If the file does not contain a private key, HAProxy will attempt to load the key from the same path with a **.key** suffix.

  
If a directory name is used instead of a PEM file, all files found in that directory will be loaded in alphabetical order, except for files ending in **.issuer**, **.ocsp**, or **.sctl** (reserved solutions). 

  
In the \[OBJECT\] parameter, specify the path to the PEM file containing the root certificate. Read more in the **Configuration Manual** for the HAProxy version used. Example for [HAProxy 2.5](https://cbonte.github.io/haproxy-dconv/2.5/configuration.html#5.1-crt):

````
\### Web BRIX365 ###  
listen brix365\_web  
    bind brix365.your\_domain:443 ssl crt /etc/haproxy/ssl/brix365-server.your\_domain.pem  
    mode http  
    balance leastconn  
    no option http-use-htx  
     # http-use-htx is deprecated and ignored since Haproxy 2.1  
     option forwardfor  
    option httpclose  
    server brix365-1 brix365-1.your\_domain:443 check inter 2s ssl crt /etc/haproxy/ssl/brix365-server.your\_domain.pem ca-file /etc/haproxy/ssl/rootCA\_your\_domain.pem  
    server brix365-2 brix365-2.your\_domain:443 check inter 2s ssl crt /etc/haproxy/ssl/brix365-server.your\_domain.pem ca-file /etc/haproxy/ssl/rootCA\_your\_domain.pem  
    server brix365-3 brix365-3.your\_domain:443 check inter 2s ssl crt /etc/haproxy/ssl/brix365-server.your\_domain.pem ca-file /etc/haproxy/ssl/rootCA\_your\_domain.pem  
\### Web BRIX365 ###
````

3. ````
Restart HAProxy to apply changes:

````
sudo systemctl restart haproxy
````