I'm trying to add a new port for forwarding to HAProxy but whenever I try to restart the service with the new configuration I get the error

haproxy-systemd-wrapper[32276]: [ALERT] 092/112955 (32277) : Starting frontend my-service: cannot bind socket [<public IP>:4443]

I'm running haproxy through systemctl on CentOS7. Nothing else is using port 4443 (sudo netstat -apn | grep 4443 comes up blank), and I've got net.ipv4.ip_forward = 1 and net.ipv4.ip_nonlocal_bind = 1 set in sysctl.conf. I've also run sudo setsebool -P haproxy_connect_any=1.

The relevant part of my haproxy.cfg looks like this:

frontend my-service
   bind <public_url>:4443
   default_backend my-backend

I've also got other frontends binding to 80, 443 and 8080.

I've just tried adding a the port to the list of managed HTTP ports in SELinux with

sudo semanage port -a -t http_port_t -p tcp 4443

But also with no luck

  • "cannot bind socket" - you should bind the port instead :) – Orphans Apr 2 '20 at 11:18
  • Is that not what I'm doing in that config? – Mourndark Apr 2 '20 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.