How to reject requested path without getting to webserver with HaProxy
-
I am using HaProxy, and I would like to reject a requested path, but not have any request go to webserver. It seems that the path options ads a http-request test, which ends up going to the server at least for a hit, even when returning an error. If I try adding a tcp-request deny rule, I get this error: "a 'tcp-request' rule placed after an 'http-request' rule will still be processed before." because the http-request rule is used to get the path. What is the best way to do this?
Thanks.
-
What do you want to be sent back to the web client?
-
@Derelict either no response, or 403.
-
So match the URL and use
http-request deny
in the frontend.https://www.haproxy.com/blog/introduction-to-haproxy-acls/
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.