Octoprint load like subdomain haproxy

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 ?

Please don't open more than one topic per question. Closing this one since your other one already got a reply.