Setting Up HAProxy on SELinux
I use HAProxy as a reverse proxy for the web servers hosted on my server. I tried to use my existing HAProxy configuration as-is, but SELinux required different settings.
1. Replace localhost with 127.0.0.1
In SELinux, localhost prioritizes IPv6 resolution, which can cause the proxy to malfunction. In my case, I had the proxy host set to localhost, and I had to change it to 127.0.0.1.
2. Add proxy ports
SELinux manages allowed ports for each service separately. When running multiple servers, you need to either add ports individually or grant permission to access all ports. I chose the latter approach:
sudo setsebool -P haproxy_connect_any=1