Skip to content

Instantly share code, notes, and snippets.

@PatrickJS
Forked from bwiggs/haproxy.config
Created January 25, 2021 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatrickJS/62f620bd2b8448a52502ee8d219e6f65 to your computer and use it in GitHub Desktop.
Save PatrickJS/62f620bd2b8448a52502ee8d219e6f65 to your computer and use it in GitHub Desktop.
HAProxy Config File Example
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