HAProxy Enterprise Documentation 1.6r2

Reject

You can reject a TCP connection or HTTP request by using one of the following directives in a frontend or listen section:

Directive

Result

tcp-request content reject

Closes the connection without a response once a session has been created, but before the HTTP parser has been initialized. These requests still show in your logs.

tcp-request connection reject

Closes the connection without a response at the earliest point, before a session has been created. These requests do not show in your logs.

A reject response closes the connection immediately without sending a response. The client's browser will display a "The connection was reset" error page.

In the following example, we reject requests originating from IP addresses we wish to block:

frontend www
   bind :80
   acl blocked_ip src -f /etc/hapee-1.6/blocklist.acl
   tcp-request connection reject if blocked_ip
   default_backend webservers

Next up

TLS