# Pfsense HAProxy

1. Общие настройки frontend
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179339217/bf015181-c8e7-42fc-825b-84295c65f61e.png align="center")
    
    2. Настраиваем Backend
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179411054/ebdc02de-689a-469b-a60c-6480ccb71c8d.png align="center")
        
        3. Настройка для HTTPS
            
            ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179535329/60622115-640a-4ee8-8f3d-7f7447c7fd06.png align="center")
            
            ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179643673/7c6cab64-43cf-4fc9-95c6-a6f012a4a9a9.png align="center")
            
            4. Настройка для HTTP с выполнением редиректа на HTTPS
                
                ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179770968/deabfc79-d6f4-4fb2-b5ac-07f09d7c5887.png align="center")
                
                ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179836556/4f9ae835-f2cf-4265-947b-c533af9526c9.png align="center")
                
                5. Настраиваем Frontend для HTTPS
                    
                    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179931661/aa652d44-c5ae-49db-a390-44a20ffd89ef.png align="center")
                    
                    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179958874/8867e659-48cf-439f-a996-b1244c300e17.png align="center")
                    
                    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732179985463/aace579e-bedc-4c74-a545-f4e038719f93.png align="center")
                    
                    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732180018897/498d480e-253d-4b21-b01e-ee2368758314.png align="center")
                    
                    6. Настраиваем Frontend для HTTP
                        
                        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732180094151/1c35d2c7-3fd4-449c-a63e-8ddba7d7fb02.png align="center")
                        
                        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732180123010/abc475e5-c7f5-4c75-b68b-e81efc247195.png align="center")
                        
                        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732180145431/76740410-3e24-418b-a14d-aad7a440c85b.png align="center")
                        
                        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732180193141/6a66c1f1-07e3-406a-9146-eb2bd4cf2f73.png align="center")
                        
                        | Action | Parameters | Condition acl names | Actions |  |
                        | --- | --- | --- | --- | --- |
                        |  | http-request redirect | See below | redirect1 |  |
                        |  | rule: code 301 location [https://autotrade.kiev.ua%\[path\]?%\[query\]](https://autotrade.kiev.ua%25%5Bpath%5D?%25%5Bquery%5D) |  |  |  |
                        |  | http-request redirect | See below | redirect2 |  |
                        |  | rule: code 301 location [https://%\[hdr(host)\]%\[path\]?%\[query\]](https://%25%5Bhdr\(host\)%5D%25%5Bpath%5D?%25%5Bquery%5D) |  |  |  |
                        |  | http-request redirect | See below | redirect3 |  |
                        |  | rule: code 301 location [https://%\[hdr(host)\]%\[path\]?%\[query\]](https://%25%5Bhdr\(host\)%5D%25%5Bpath%5D?%25%5Bquery%5D) |  |  |  |
                        |  | http-request redirect | See below | redirect4 |  |
                        |  | rule: code 301 location [https://autotrade.kiev.ua%\[path\]?%\[query\]](https://autotrade.kiev.ua%25%5Bpath%5D?%25%5Bquery%5D) |  |  |  |
                        |  | http-request redirect | See below | redirect5 |  |
                        |  | rule: code 301 location [https://autotrade.kiev.ua%\[path\]?%\[query\]](https://autotrade.kiev.ua%25%5Bpath%5D?%25%5Bquery%5D) |  |  |  |
                        |  | http-request redirect | See below | redirect6 |  |
                        |  | rule: code 301 location [https://autotrade.kiev.ua%\[path\]?%\[query\]](https://autotrade.kiev.ua%25%5Bpath%5D?%25%5Bquery%5D) |  |  |  |
                        |  | http-request redirect | See below | redirect7 |  |
                        |  | rule: code 301 location [https://idp.com.cy%\[path\]?%\[query\]](https://idp.com.cy%25%5Bpath%5D?%25%5Bquery%5D) |  |  |  |
                        |  | http-request redirect | See below | redirect8 |  |
                        |  | rule: code 301 location [https://duettestates.com.cy%\[path\]?%\[query\]](https://duettestates.com.cy%25%5Bpath%5D?%25%5Bquery%5D) |  |  |  |
                        |  | Use Backend | See below | redirect9 |  |
                        |  | backend: [autotrade.kiev.ua](http://autotrade.kiev.ua)\-81 |  |  |  |
                        |  | Use Backend | See below | redirect10 |  |
                        
                        Если есть необходимость сайту получать реальный ip клиента то нужно установить галочку **Use Client-IP to connect to backend servers** в вашем [Backend](https://gw01.dc24.cloud:4443/haproxy/haproxy_pools.php) и указать интерфейс на котором находится [Backend](https://gw01.dc24.cloud:4443/haproxy/haproxy_pools.php).
                        
                        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1732689505791/740e7186-0f80-478f-9910-53e630caeac3.png align="center")
