Forum Discussion
Patti_G_72768
Nimbostratus
Oct 21, 2013iRule for missing or blank headers (user-agent and accept)
Hi all, I'm working on another iRule creation. I need to create a rule that will detect if the request headers for user-agent and/or accept is blank/missing. I also need to be able to exclude uri ext...
What_Lies_Bene1
Cirrostratus
Oct 21, 2013It's slightly less specific but this should work (note the HTTP::header command will return null if the header doesn't exist or if the header's value is null);
if { [HTTP::uri] ends_with "rss" or [HTTP::uri] ends_with "smil" } {
log local0. "URI extension is rss or smil."
Optionally drop the traffic
reject
Stop executing the irule
return }
elseif { [HTTP::header "User-Agent"] eq "" } {
log local0. "User-Agent header is missing or blank." }
elseif { [HTTP::header "Accept"] eq "" } {
log local0. "Accept header is missing or blank." }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects