Skip to content

Instantly share code, notes, and snippets.

@dhavaln
Last active October 10, 2023 13:49
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save dhavaln/2fed8e1484d516e08a11a20cff795dba to your computer and use it in GitHub Desktop.
Save dhavaln/2fed8e1484d516e08a11a20cff795dba to your computer and use it in GitHub Desktop.
Setting up HAProxy on Mac OSX
global
log 127.0.0.1 local0
log 127.0.0.1 local1 debug
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
#daemon
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
timeout connect 5000
timeout client 50000
timeout server 50000
frontend localnodes
bind *:8000
mode http
default_backend nodes
backend nodes
mode http
balance roundrobin
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
option httpchk HEAD / HTTP/1.1\r\nHost:localhost
server server1 192.168.1.135:3000 check
Install HAProxy from Homebre:
`brew install haproxy`
For full reference:
https://serversforhackers.com/load-balancing-with-haproxy
@cirocosta
Copy link

thx for the gist!

I needed to install from source and have Lua support to, so I wrote this quick article: https://ops.tips/blog/installing-haproxy-lua-macos/

I hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment