haproxy for local network path redirection trouble

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
Quickolas
Posts: 1
Joined: Sat Aug 24, 2019 10:51 pm

haproxy for local network path redirection trouble

Post by Quickolas »

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 -> 192.168.1.12
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

Code: Select all

nick.pi/octoprint
will be redirected to :5000 and the same with other paths.
I tried to use this strategy https://github.com/PrusaMK2Users/MK2_Ti ... aproxy.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.
User avatar
MichaIng
Site Admin
Posts: 2281
Joined: Sat Nov 18, 2017 6:21 pm

Re: haproxy for local network path redirection trouble

Post by MichaIng »

@Quickolas
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?
Post Reply