Forum Discussion
Dave_Wu_20200
Dec 09, 2011Nimbostratus
Rate Shaping using url and ip address
Hi Guys,
I am attempting to write a irule to shape bandwidth by using source ip address xxx.xxx.xxx.xxx and host of xyz.com.
Could I use something like that
when HTTP_REQUEST {
...
hooleylist
Dec 09, 2011Cirrostratus
Hi Dave,
Just a couple of small suggestions. Set the host to lower case as it should be matched case insensitively. Also, using an equals operator like == or eq would (eventually) do a string comparison. A bitwise comparison with IP::addr will be more efficient and support CIDR.
http://devcentral.f5.com/wiki/iRules.ip__addr.ashx
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "xyz.com" && [IP::addr [IP::client_addr] equals xxx.xxx.xxx.xxx] }
rateclass rateshape1
}
}
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