Forum Discussion
7 Replies
Sort By
- EddieJK_26590Nimbostratus
This is the iRule:
if { [HTTP::header exists "User-Agent"]} { if { [HTTP::header "User-Agent"] equals "" } { reject } }
- Vijay_ECirrus
iRule looks to be good. Try it out. Make sure to add "when HTTP_REQUEST" as the event.
- EddieJK_26590Nimbostratus
I am getting the following error:
The requested object name (user agents) is invalid
- Vijay_ECirrus
Remove the quotes around User-Agent
- EddieJK_26590Nimbostratus
I changed it to the following below, but still have the same error.
when HTTP_RESPONSE { if { [HTTP::header exists User-Agent]} { if { [HTTP::header User-Agent] equals "" } { reject } }
- Vijay_ECirrus
If you need to block incoming request from client, you need to use HTTP_REQUEST
- David__PaschAltostratus
I was not able to test these, but either should get you the results you are looking for:
when HTTP_REQUEST { if {[class match [HTTP::header "User-Agent"] equals ""]} { reject }}
OR
when HTTP_REQUEST { if { [HTTP::header exists User-Agent]} { if { [HTTP::header User-Agent] equals "" } { reject }}}
Good Luck!