Unreachables backends from my HAProxy

Hello all, i’m trying to explain my setup at my best. Just for testing purposes i’m trying to expose a jenkins instance and a web-server behind an HAproxy. The environment is running locally on my machine using vagrant for provisioning.

Machine A: 192.168.121.10
Machine B: 192.168.121.11

On machine A, webserver is apache and it runs on default settings on port 80 and there is a simple index page that i want to reach. On the same machine a docker image of Jenkins is up and running on port 9000.

On machine B i configured my HAProxy as:

  global
  log 127.0.0.1 local0 notice
  maxconn 4096
  daemon

defaults 
  log global
  option httplog
  option dontlognull
  maxconn 20
  mode http
  timeout client 60s
  timeout server 60s

frontend main
  bind 192.168.121.11:9000
  acl url_apache path_beg /apache
  use_backend apache if url_apache

  default_backend  jenkins-mstr

backend jenkins-mstr
  server jenkins01 192.168.121.10:8000 check

backend apache
  reqrep ^([^\ ]*)\ /apache(.*)  \1\ \2 #convert /apache from frontend to / on backend
  server apache01 192.168.121.10:80 check 

As you see what i want to achieve is to reach the apache-server from machineB:9000/apache and reach jenkins from machineB:9000 .

Instead, what i got is:

 machineB:9000 --> 503

 machineB:9000/apache --> 400 bad request

I do not have any additional conf files for apache and i restart my HAProxy with systemctl restart haproxy to let configs take effetcs.

What am i missing ? I’m really stuck and any help would be extremely great.

Thanks

Are you sure you exposed your jenkins docker container on this port?

1 Like

Yes sure, i can reach Jenkins from machineA with no problem at all