Score:0

HaProxy redirect to internal URL

ht flag

I have a configuration with two backend servers I need to redirect 301 to each server with an internal URL on HTTP. It's hard to use SSL because I can't install SSL on the Report Server in that configuration. Also, I can't use the virtual domain and shared IP to redirect traffic because there is some internal issue with Report Viewer when viewing reports. I just need to redirect traffic to the backend server, preferably with an internal URL, but the IP will also be ok.

At the moment I know how to do it to one specific host but not to the current server.

Configuration: Active/Passive configuration for the backend.

  1. HA-Proxy version 2.0.29-0ubuntu1

  2. Ubuntu 20.04.5 LTS

  3. Keepalived v2.0.19

    frontend raporty
         bind 192.168.0..108:80
         bind 192.168.0.108:443 ssl crt /etc/ssl/certs/haproxy.pem
         default_backend reportserver
         option forwardfor
    
    backend reportserver
         mode http
         balance roundrobin
         option httpchk uri /reports
         http-check  expect status 401
         http-response set-header X-Server %s
         http-request redirect  code 301  location http://sql02.domain.local%[capture.req.uri]
         server   sql01  192.168.0.11:80 check check fall 5
         server   sql02  192.168.0.111:80 check check fall 5
         http-response set-header X-Server %s
    
Score:0
ht flag

This was managed by using the ACL and the srv_is_up parameter.

frontend raporty
        bind 192.168.0.108:80
        bind 192.168.0.108:443 ssl crt  /etc/ssl/certs/haproxy.pem
        http-response set-header X-Server %s
        http-response set-header Host %s
        default_backend reportserver
        option forwardfor



backend reportserver
        mode http
        balance roundrobin
        option httpchk uri /reports
        http-check  expect status 401
        acl asql01 srv_is_up(reportserver/sql01)
        acl asql02 srv_is_up(reportserver/sql02)
        http-request set-header Host %s
        http-response set-header Host %s
        http-request redirect  code 301 location http://sql01.domain.local%[capture.req.uri]  if asql01
        http-request redirect  code 301 location http://sql02.domain.local%[capture.req.uri]  if asql02
        server   sql01  sql01.domain.local:80 check check fall 5
        server   sql02  sql02.domain.local:80 check check fall 5
        http-response set-header X-Server %s
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.