php – haproxy domain on seperate system is not accessible properly-ThrowExceptions

Exception or error:

I have to server a domain from two different web-servers. On each server, completely a new domain is hosted. I have one domain and want to redirect on sub-folder. I have configured haproxy at front with following configurations:

frontend http
    bind *:80
    mode http
    acl andr_req path_beg    -i /tds
    use_backend tdsApp     if andr_req
    default_backend apache

backend tdsApp
        mode http
        balance roundrobin
        option forwardfor
        http-request set-path /main/
        server ser1 10.11.12.6:80 check

backend apache
    mode http
    balance roundrobin
    option forwardfor
    server web01 10.11.12.5:80 check

As acl instructs if example.com/tds is requested then it should redirect traffic to 10.11.12.6:80/main otherwise to 10.11.12.5:80. Now what is happening is that /tds is redirected to proper server but I got error like

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 347

Basically, all code is in php, normally it works fine when accessed directly. Where is the problem. Should I update haproxy or webserver configuration.
Moreover, domain that is on same machine where load balancer is, works fine

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *