Skip to content

Instantly share code, notes, and snippets.

@sambacha
Forked from bwiggs/haproxy.config
Last active June 20, 2020 11:46
Show Gist options
  • Select an option

  • Save sambacha/a496d540ab60bce5e446fd37ee7017a1 to your computer and use it in GitHub Desktop.

Select an option

Save sambacha/a496d540ab60bce5e446fd37ee7017a1 to your computer and use it in GitHub Desktop.
HAProxy Config File Example for Hyperledger Besu
frontend discovery-tcp-30303
bind *:30303
acl ...
...
default_backend back-discovery-tcp-30303
frontend rpc-tcp-8545
bind *:8545
acl ...
...
default_backend back-rpc-tcp-8545
backend back-discovery-tcp-30303
balance leastconn
server node-01 10.0.1.1:30303 weight 1 check
server node-02 10.0.1.2:30303 weight 1 check
option ...
timeout server 600s
backend back-rpc-tcp-8545
balance leastconn
server node-01 10.0.1.1:8545 weight 1 check
server node-02 10.0.1.2:8545 weight 1 check
option ....
timeout server 600s
...
global
#debug # uncomment to enable debug mode for HAProxy
defaults
mode http # enable http mode which gives of layer 7 filtering
timeout connect 5000ms # max time to wait for a connection attempt to a server to succeed
timeout client 50000ms # max inactivity time on the client side
timeout server 50000ms # max inactivity time on the server side
backend legacy # define a group of backend servers to handle legacy requests
server legacy_server 127.0.0.1:8001 # add a server to this backend
frontend app *:80 # define what port to listed to for HAProxy
default_backend legacy # set the default server for all request
global
#debug
defaults
mode http
option httpclose # close the tcp connection after every request
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
backend legacy
server legacy_server 127.0.0.1:8001
backend rails # define a group of backend servers to handle rails requests
server rails_server 127.0.0.1:8002 # add a server to this backend
frontend app *:80
default_backend legacy
acl rails_path path_beg /profile # acl rule for paths to be handled by the new rails app
use_backend rails if rails_path # use rails if the rules match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment