Forum Discussion

ndel_119904's avatar
ndel_119904
Icon for Nimbostratus rankNimbostratus
May 28, 2013

Redirect with iRule or HTTP Class profile?

I know you can route/redirect HTTP requests to pools/nodes and rewrite URIs with an iRule, but I also noticed you can do the same with the HTTP Class profile.

 

I know iRules are far more powerful and tailored to any traffic type/request, whereas the HTTP Class profile is just tailored to redirect/rewrites for HTTP traffic, but is one better than the other? Is one preferred over the other?

 

Thanks

 

7 Replies

  • Usually if there is an option in the GUI to do something it provides better performance than an iRule.
  • Anything that you can do in an HTTP profile is going to be faster, so it is preferred.

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    The HTTP Profiles can certainly serve a purpose, but they are very basic. For instance, the redirect is limited to 302. Many times a 301 is the better option, which would require an iRule.

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account

    I agree with all of the above responses. In teaching the iRules Optimization courses over the years one of the things we've always said is "If you can use a built in feature, do so." Compiled, built-in functionality will always be higher performance than a script. Even one as highly optimized as an iRule. Beyond just performance there are the issues of supportability, upgrade paths, ease of use, etc. Built-in wins, no matter how easy, fast and reliable iRules are.

     

    Arie makes an excellent point also, however. When the built in features don't offer the exact functionality you want, that is the precise reason that iRules exists as an option. When you're looking to customize things for your environment beyond the capabilities of what is built in, iRules is where it's at.

     

    Colin
  • Just FYI, in 11.4, HTTP Class is deprecated and will not work. The centralized policy matching system (CPM) takes its place.
  • Just wanted to add my recent experience with this in that we recently replaced some legacy iRules doing a redirection with an HTTP Class. This was great until I then wanted to do some other work on HTTP::uri in another rule. I hit a brick wall when I found that the redirect in the HTTPClass is applied after my new iRule was processed compared to the old iRule redirect which did it before the new iRule was executed, via a priority setting. So I've had to revert to using the iRule approach in order to handle a special case redirect before a new global filtering rule processed the request.

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account

    There are definitely some things to keep in mind when selecting an iRule vs. a built in feature, such as HTTP Class. Prioritization and the flexibility that you get with iRules is a powerful benefit, to be sure. In a deployment advanced enough that such things matter and you're going to be bleeding into iRules anyway, I might recommend just going full bore with iRules, since mixing the two is, as you've noticed, sometimes problematic. For a large number of deployments, however, that are doing simple matching and replacements HTTP Classes, or the new CPM engine, are more then powerful enough without dipping into the iRules bag of tricks properly.

     

    There's a solution out there for everyone's deployment, it's just a matter of picking the right one, sometimes. ;)