Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@meineerde
Created November 23, 2017 16:58
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 meineerde/ca68bbf782c36a12be299a9f915bfb75 to your computer and use it in GitHub Desktop.
Save meineerde/ca68bbf782c36a12be299a9f915bfb75 to your computer and use it in GitHub Desktop.
HAProxy: Deny a request while keeping the client-connection alive
frontend main
bind :443 ssl crt /tmp/foo.pem
mode http
option http-keep-alive
# ...
use_backend bk_deny if { path_beg /you/didnt/say/the/magic/word }
default_backend bk_servers
frontent deny
bind 127.0.0.1:8001
mode http
http-request deny
backend bk_servers
# your normal servers
server foo 10.42.42.42:80
server bar 10.23.23.23:80
backend bk_deny
server deny 127.0.0.1:8001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment