Forum Discussion
winifred_corbet
Nimbostratus
Aug 18, 2010Dozens of 301 redirects - can we use --- class 301_redirect
We have many irules that handle nothing but 301 redirects, for example, dozens of these types of entries in on irule.
We are looking for a way to streamline and make more efficient irules since we are coming up on a redesign,a nd we will need many more 301 redirects.
Can we use a type of data group list for all these entries? Then remove all these entries from the actual irule?
when HTTP_REQUEST {
if {
[HTTP::uri] equals "/cda//lots-of-stuff-here"
} {
HTTP::respond 301 Location "http://www.website.com/lists/mental.../index.php"
}
elseif {
[HTTP::uri] equals "/cda/verify-specific-url"
} {
HTTP::respond 301 Location ""
}
- hoolio
Cirrostratus
dupe - hoolio
Cirrostratus
Hi Winifred, - winifred_corbet
Nimbostratus
How does that work when every - naladar_65658
Altostratus
I would say if you have less than a hundred of these then putting them into a switch statement would be a really efficient way for the F5 BIG-IP to process it. I have about 80 of these in one switch statement on a high volume VIP and it costs almost nothing computation wise on our 6400 series hardware.when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri] ] { "/cda/lots-of-stuff-here*" { HTTP::respond 301 Location "http://www.website.com/lists/mental.../index.php" } "/cda/verify-specific-url*" { HTTP::respond 301 Location "" } } }
- Colin_Walker_12Historic F5 AccountNaladar is right on. Generally speaking I recommend a switch statement up to about 100 or 150 entries, as long as it remains manageable in the code. Past that using a class match is your best bet, and that scales well into the thousands, depending on class structure and content.
- winifred_corbet
Nimbostratus
Definately will use the switch statement for our sites will smaller amounts of redirects. Thanks for that info. - naladar_65658
Altostratus
In my mind setting up thousands of those using either method is going to be a beast. In this kind of situation (URI matching) Data Groups really are useful when you have several URI's that would use the same 301 Location. So you have a many-to-one mapping with your Data Group. In your situation though it sounds like you have a one-to-one mapping with your Data Groups, meaning one datagroup is only going to match one URI path and then redirect to one 301 Location. I am not certain of the best method in this case.
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