HAProxy doesn't resolve on LAN interface
-
Hello,
I followed this guide to configure HAProxy as a reverse proxy https://www.youtube.com/watch?v=bU85dgHSb2E
After following the guide and ensuring that I perform all the steps correctly, I couldn't access the servers locally by selecting the LAN interface in the Frontend. Instead, by selecting the WAN interface, I was able to access externally without any issues.
I tried testing by selecting both WAN and LAN interfaces in the Frontend, and the same thing happened – it worked externally but not locally. Every time I tried locally, I got an ERR_CONNECTION_REFUSED.
So, I decided to try selecting ANY as the Frontend interface... and surprise... it works both externally and locally!
What could be the problem? Why does selecting WAN always work, LAN never works, and ANY work for both? Something is escaping me...
-
@juananpc
If you want to access the server with the LAN IP you even need to configure your internal DNS to resolve your host name to the LAN IP. -
@viragomann Hello, thank you for responding.
I might not have explained myself clearly. In the DNS Resolver configuration, I have the servers included in the Host Overrides list pointing to the pfSense LAN IP.
In fact, the host resolves correctly locally when I select "any (IPv4)" in the HAProxy frontend. I've also verified this with nslookup.
The issue come when, instead of selecting "any" (IPv4) in the frontend, I choose the "LAN address (IPv4)" option. Then I encounter an ERR_CONNECTION_REFUSED.
-
@juananpc said in HAProxy doesn't resolve on LAN interface:
instead of selecting "any" (IPv4) in the frontend,
What exactly are you trying to proxy? Why would you pick the lan address?? I have to things I run through ha proxy. One frontent directly listens on my wan IP. Other listens on my loopback since I share this port with openvpn 443, and when its not openvpn traffic, openvpn using share port option sends this to the loopback on a port 9443 and haproxy sends that on to the backend.
If I want to access either of these from my lan, I access my wan IP on the ports being used 443 or 44301 and the proxy sends me to the backend.