Forum Discussion
Bob_10976
Feb 24, 2011Nimbostratus
iRule Error for HTTP::respond 404
Hello all,
I'm attempting to create an iRule that will block Microsoft Office Protocol Discovery User Agent from a specfic list of VS and I keep coming up with the error:
line 4: [wrong args] [HTTP::respond]
I'm still pretty green to iRule so if anyone has any thoughts on where I'm messing up please let me know. I have the posted the code below.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::header "User-Agent"]] {
"Microsoft Office Protocol Discovery"
HTTP::respond 404
}
}
Thanks,
Bob
- hooleylistCirrostratusHi Bob,
- Bob_10976NimbostratusAaron,
when HTTP_REQUEST { switch -glob [string tolower [HTTP::header "user-agent"]] { "microsoft office protocol discovery" HTTP::respond 404 content "" } }
- hooleylistCirrostratusSorry, I wasn't reading your rule closely enough. There are a couple of brackets missing:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::header "user-agent"]] { "*microsoft office protocol discovery*" { HTTP::respond 404 } } }
- Bob_10976NimbostratusThanks Aaron.. I see it now.. Btw just a quick follow up.. The iRule is working, I can use Fiddler and see a 404 response on the User Agent for microsoft office protocol discovery, however I'm finding that I also need to block the Microsoft-WebDAV-MiniRedir/6.1.7600 User Agent as well. I believe what I have below is correct, syntax wise but since its not blocking as I would expected I wanted to run it by this group to confirm its sound and maybe I'm looking over something else...
when HTTP_REQUEST { switch -glob [string tolower [HTTP::header "user-agent"]] { "*microsoft office protocol discovery*" - "*microsoft-webdAV-miniredir/6.1.7600*" { HTTP::respond 404 } } }
- hooleylistCirrostratusMake sure to set all characters in the user-agent pattern to lower case as you're setting the user-agent header value to lower case.
- Bob_10976NimbostratusWow!! Its always the little things that getcha.. Thanks a ton for all the help Aaron.
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