Forum Discussion
Rewrite, iRule
Hi,
we have the following situation.
name.abc.com/ -> ProdServerFQDN/application
name.abc.com/dev -> DevServerFQDN/application
For casting / -> /application and /dev -> /application we are using a rewrite-profile. Now we want to use an iRule for choosing the destination pool. That's where the order, how the F5 processes rewrite-profiles and iRules, comes into play. Because of the rewrite our iRule has no information about the original uri and can not work properly.
Is there any way to get around this problem? Does the F5 keep the original uri somewhere (variable) when rewriting it or can we somehow adjust the processing order of our rewrite-profiles and iRules?
- ArieAltostratus
I'm thinking if you need to stack functionality you may want to move the rewrite to the iRule as well. Otherwise it becomes rather murky.
Keep in mind that F5's strategy has always been to internalize certain features if a lot of customers relied on iRules for those. The redirect and rewrite profiles are good examples of those. In addition, using iRules gives you full control over and access to the request values.
Unfortunately, profiles tend to limit the option, at times to the detriment of standards like RFC 7230 et al. For instance, the redirect profile is still limited (or at least used to be for years) to 302. Of course, to a degree this applies to the
in iRules as well, but at least one could useHTTP::redirect
instead. But I digress...HTTP::respond
- ArieAltostratus
A few observations after a quick glance:
- Instead of
I would recommend matching (i.e.starts_with
) the actual host. This avoids issues if another instance is added at some point.eq
- The FQDN you're using is invalid. Although I assume it's a placeholder, make sure you drop the slash (
)./
- The path you're matching (
) may be too limited. Keep in mind that other valid matches may include/dev
,/dev/
, et cetera. This would be a good candidate for/dev/index.html
.starts_with
- I would group the header manipulations. In other words, move the pool selection to the bottom.
- Instead of
Recent Discussions
Related Content
* 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