andreszam24
andreszam24

Reputation: 351

I get blank page from Angular when use HAproxy

I have a lot application deployed, and I use HAproxy for redirect to apps with the path. For the default path the angular app ch-frontend:80 works fine, but the other angular app I get a blank page. this is the configuration for HAproxy:

global
    daemon
    maxconn 2048
    log stdout format raw local0 debug
    # tune.ssl.default-dh-param 2048

defaults
    log global
    mode http
    option forwardfor
    option http-server-close
    timeout connect 5000ms
    timeout client 300000ms
    timeout server 300000ms

frontend www-http
    bind *:80
    # bind *:443 ssl crt /usr/local/etc/haproxy/test.pem
    #http-request redirect scheme https unless { ssl_fc }

    #http-request add-header X-Proto https if { ssl_fc }
    
    use_backend api_laravel if { path_beg /main/ }
    use_backend front_encuestas if { path_beg /clinica/ }
    use_backend api_analitica if { path_beg /api-analitica/ }   
    default_backend checktime_front
    
backend checktime_front
    server checktime_front1 ch-frontend:80 maxconn 32

backend api_laravel
    mode http
    server api_laravel1 ch-backend:80/main maxconn 32

backend front_encuestas
    mode http
    #http-request set-path "%[path,regsub(^/clinica/,/,)]"
    server front_encuestas1 ch-frontend-encuestas:80 maxconn 32

backend api_analitica
    mode http
    http-request set-path "%[path,regsub(^/api-analitica/,/,)]"
    server api_analitica1 ch-api-analitica:8080/ maxconn 32

but when try get the app angular ch-frontend-encuestas I get this:

enter image description here If try access directly to container without HAproxy the app works OK.

Someone Can explain me that happen please?

Upvotes: 0

Views: 484

Answers (1)

andreszam24
andreszam24

Reputation: 351

The problem wasn't in the haproxy configuration but that in the build of Angular project. So, I resolve the problem adding --base-href /path_app/ in ng build

Upvotes: 0

Related Questions