Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4832

Trying to block empty or null user-agent traffic into the site

$
0
0

Hello HAProxy friends,

I am trying to block empty or null user-agent traffic into our site.

I’m using HAProxy 2.4.17

I have the following two ACLs and two http-request denies, but neither are working when i spoof user-agents to be empty

    # Identify if user-agent is found
    acl found-user-agent req.fhdr(user-agent) -m found

    # Identify if user-agent has characters
    acl char-user-agent  req.hdr_cnt(user-agent) eq 0

    # Identify if source IP is internal
    acl internal-ip       src                172.16.0.0/16
.....
    # Send HTTP 502 if request does not have a User-Agent and not internal-ip
    http-request deny deny_status 502 if !found-user-agent !internal-ip

    # Send HTTP 502 if request has zero character user-agent and not internal-ip
    http-request deny deny_status 502 if char-user-agent !internal-ip

Any thoughts on what is going on and where my logic isnt right?
Thanks

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4832

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>