Forum Discussion
mikey_webb
Cirrus
Jan 07, 2015Help with pattern match irule required
Need help with an irule to drop the request if pattern is not matched. The link and pattern is always as below whereby only the values will change....such as vid, height, quality values etc
htt...
Michael_Jenkins
Cirrostratus
Jan 22, 2015Try adding some logging like below and see what you're getting. (I did see a little typo in one of the patterns and fixed it)
when HTTP_REQUEST {
if { [class match [IP::client_addr] equals private_net] } {
log local0. "IP is private"
Internal IP match - do nothing
} else {
log local0. "IP is not private"
switch -glob -- [string tolower [HTTP::uri]] {
"/getimage.aspx?vid=*&usehttp=*&cat=*&class=*&size=*&resize=*&dpi=*&quality=*&type=*&width=*&height=*&id=*" -
"/getimage.aspx?vid=*&usehttp=*&cat=*&shade=*&background=*&colour=*" {
Looks good. Do nothing
log local0. " Pattern match found"
}
default {
log local0. " Pattern didn't match. Respond 400"
HTTP::respond 400
}
}
}
}
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