Forum Discussion
filter based on "User-Agent" , irule
I want permit traffic to a VIP only if the User-Agent matches "Chrome/52.0.2743.98" Does the below irule works?. Also i want to add logging.
when HTTP_REQUEST { if {[HTTP::header "User-Agent"] contains "Chrome/52.0.2743.98" } { return } else { drop } }
- PeteWhite
Employee
Yes, that iRule should do the job although it is a little blunt. You also want to consider whether contains is good enough or you should have exact matching.
Logging can be done locally to /var/log/ltm with the log command eg
but ideally you would do regular logging to a remote server via HSL.log local0.debug "User Agent: [HTTP::header user-agent]"
You may also want to check if the User-Agent header exists - note that HTTP headers are non case sensitive.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com