Skip to content

Instantly share code, notes, and snippets.

@dsuch
Created June 26, 2013 22:18
Show Gist options
  • Save dsuch/5872245 to your computer and use it in GitHub Desktop.
Save dsuch/5872245 to your computer and use it in GitHub Desktop.
HAProxy config for URL-based rate limiting
# At most 10 concurrent connections from a client
acl too_fast fe_sess_rate ge 10
# Matches any path beginning with a given prefix
acl bursts_inclined path_beg -i /client1
# Effectively working as a delay mechanism for clients that are too fast
tcp-request inspect-delay 1000ms
# Fast-path - accept connection if it's not this troublesome client
tcp-request content accept unless bursts_inclined too_fast
# The very fast client gets here meaning they have to wait full inspect-delay
tcp-request content accept if WAIT_END
@isaacegglestone
Copy link

What version is this good for?

@dsuch
Copy link
Author

dsuch commented May 23, 2015

Hi @isaacegglestone,

apologies but I haven't spotted your question before.

It's for HAProxy 1.5 and later.

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