﻿# Configure HAProxy for the Service Portal

> [HTML Version](haproxy-external-portal.html)

This article shows an example of configuring HAProxy to access a Service Portal at a designated domain name using a reverse proxy.

````
начало внимание

````
Before you start, you need to enable and activate a [Service Portal](service-portal.md). 

````
конец внимание

````
We also recommend configuring HAProxy for BRIX with a reverse proxy based on the instructions in the [Configure HAProxy to use BRIX behind a reverse proxy article](haproxy-elma365.md).

The following data is used in the example:

- \[OBJECT\]. Name of the workspace with an activated portal.

- \[OBJECT\]. The Service Portal domain name.

- \[OBJECT\]. IP address of the server with the BRIX application.

Here is an example of reverse proxy configuration to access a Service Portal at a designated domain with HAProxy:

````
global  
   maxconn 10000  
   log /dev/log   local0  
   log /dev/log   local1 notice  
   chroot /var/lib/haproxy  
   stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners  
   stats timeout 30s  
   user haproxy  
   group haproxy  
   daemon  
  
   ca-base /etc/ssl/certs  
   crt-base /etc/ssl/private  
  
        ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384  
        ssl-default-bind-ciphersuites TLS\_AES\_128\_GCM\_SHA256:TLS\_AES\_256\_GCM\_SHA384:TLS\_CHACHA20\_POLY1305\_SHA256  
        ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets  
  
defaults  
   log   global  
   mode   http  
   option   httplog  
   option   dontlognull  
   timeout connect 5000  
   timeout client  50000  
   timeout server  50000  
   errorfile 400 /etc/haproxy/errors/400.http  
   errorfile 403 /etc/haproxy/errors/403.http  
   errorfile 408 /etc/haproxy/errors/408.http  
   errorfile 500 /etc/haproxy/errors/500.http  
   errorfile 502 /etc/haproxy/errors/502.http  
   errorfile 503 /etc/haproxy/errors/503.http  
   errorfile 504 /etc/haproxy/errors/504.http  
  
frontend brix365\_portal  
       mode http  
       bind \*:80  
       bind \*:443 ssl crt /etc/ssl/private/brix365.pem  
       redirect scheme https code 301 unless \{ ssl\_fc \}  
       maxconn 10000  
  
       acl brix365 hdr(host) -i portal-brix365client.domain.com  
       use\_backend brix365\_server if brix365  
  
backend brix365\_server  
       mode http  
       balance leastconn  
       option forwardfor  
       option httpclose  
  
       acl brix365\_portal\_url url\_beg -i /\_portal/orders   
       acl brix365\_redirect url -i /index.html  
       acl brix365\_portal\_addr url\_reg -i ^.+.(jpg|jpeg|gif|png|svg|ico|js|woff|woff|woff2|css|po)\$  
       acl brix365\_portal\_addr url\_beg -i /ws /api /s3brix365 /guard /assets  
  
       http-request redirect code 301 prefix /\_portal/orders  if brix365\_redirect OR \!brix365\_portal\_url \!brix365\_portal\_addr  
       http-request deny if \!brix365\_portal\_url \!brix365\_portal\_addr \!brix365\_redirect  
  
       server brix365-1 192.168.1.10:443 verify none check ssl

````
During installation or reconfiguration, in the **Enter BRIX domain name (FQDN) or IP address** field, specify \[OBJECT\]** **as the external domain that BRIX will be available at and enable **SSL termination**.