Octoprint haproxy apache

I use octoprint and haproxy
also I have apache server
I load apache in 8088
In my situation is octoprint is working only with this configuration:

frontend public
bind :80
use_backend apache if { path_beg /apache/ }
default_backend octoprint

backend octoprint
reqrep ^([^\ :] )\ /(. ) \1\ /\2
option forwardfor
server octoprint 127.0.0.1:5000

backend apache
reqrep ^([^\ :] )\ /apache/(. ) \1\ /\2
server apache 127.0.0.1:8088

In this way I can see octoprint in "localhost" and apache in "localhost/apache/"

I would like to see apache in localhost and
octoprint.localhost or localhost/octoprint/ for octoprint
is possible ?

Haven't had much experience with haproxy, so this is a bit of a shot in the dark.

frontend public
bind :80
use_backend octoprint if { path_beg /octoprint/ }
default_backend apache

backend octoprint
reqrep ^([^\ :]  *)\/octoprint /(.*  ) \1\ /\2
option forwardfor
server octoprint 127.0.0.1:5000

backend apache
reqrep ^([^\ :]  *)\ /(.*  ) \1\ /\2
server apache 127.0.0.1:8088