Serve 404 from HAProxy when no acls match
If you would be okay with any of the following response codes: 200, 400, 403, 405, 408, 429, 500, 502, 503, or 504.
Then you could do something like this:
frontend www
...
default_backend no-match
backend no-match
http-request deny deny_status 400
-
http-request
: http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4-http-request - Accepted response codes described in
errorfile
: http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#errorfile
After wanting something similar this is the same thing I came up with. It felt wrong but it works very well in practice and is much cleaner than trying to blacklist particular urls. Just be sure to leave a comment so no one comes across it thinking it's incorrect.