Forum Discussion

Puli's avatar
Puli
Icon for Nimbostratus rankNimbostratus
Aug 04, 2011

how to block Empty User-Agent and Empty Accept-Language values

Am trying to block request that have empty values for header fields

 

User-Agent and Accept-Language

 

 

I have below, but not sure if it check the value of the header or existence of the header field itself.

 

 

if { [HTTP::header exists "User-Agent"] and [HTTP::header exists "Accept-Language"} {

 

if { [HTTP::header "User-Agent"] equals "" and [HTTP:header "Accept-Language"] equals "" } {

 

reject

 

}

 

}

 

 

Will this work ?

 

 

Appreciate any input.

 

 

Puli.

 

2 Replies

  • Hi Puli,

     

     

    If you want to only reset the connection if both headers are set with empty values that would work fine. Just add a second colon to HTTP::header "Accept-Language"

     

     

    Aaron
  • Puli's avatar
    Puli
    Icon for Nimbostratus rankNimbostratus
    thanks Aaron.

     

    Yes, just block the request that have empty user-agent and empty Accept language values.