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:
Machine B:

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:

  log local0 notice
  maxconn 4096

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

frontend main
  acl url_apache path_beg /apache
  use_backend apache if url_apache

  default_backend  jenkins-mstr

backend jenkins-mstr
  server jenkins01 check

backend apache
  reqrep ^([^\ ]*)\ /apache(.*)  \1\ \2 #convert /apache from frontend to / on backend
  server apache01 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.


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