haproxy for local network path redirection trouble

Hello, maybe I’m using the wrong tool for the job but I’ve been trying (to no success) to use haproxy to make routing on my local network a little cleaner.

Here’s what I’ve been trying to accomplish:
I have several pi’s on my network (pihole, 3d printer, etc)
On the pihole (local.list) I’ve forwarded the hostnames ie nick.pi →
However I learned that you cannot specify a port this way, so it directs to port 80 which is fine.
On the pi in question I have a few services on different ports with octoprint being one of them. With haproxy I am trying to make it such that


will be redirected to :5000 and the same with other paths.
I tried to use this strategy https://github.com/PrusaMK2Users/MK2_Tips_and_Tricks/blob/master/Enhanced-haproxy.cfg but to no avail (503 and 404 errors) and I don’t plan on exposing this, just keeping it local.

Any advice would be appreciated, thanks.

With DNS entries, you can only attach certain IPs to certain hostnames, but no ports, that is true. DNS resolving is generally only about getting an IP for a hostname.

I never really worked with HAProxy, thus I am not sure about what is revealed and what not, however from the link you posted it looks quite fine and possible what you want.

However if it is indeed only about redirecting certain external requests to paths internally to other web applications (ports), then setting up (reverse) proxy entries for your webserver sounds like the easier and sufficient solution. A load balancer AFAIK is meant to balance load between multiple machines/webservers, but is an overkill if everything runs on a single machine with a single webserver anyway, isn’t it?