Forum Discussion
CraigM_17826
Altocumulus
Aug 30, 2007iRules not always being processed?
Hi everyone,
we are noticing a small issue when people connect to a virtual server on our BigIP. For some users the initial connection fails and the browser reports that the page is not accesable. If the user then does a refresh or just presses the ENTER key again then the page loads as expected. Clearing the users browser cache and URL history does not cause the issue to re-occur. Could this sort of behaviour be caused by a faulty iRule? Is there some limit on the number of connections to a virtual server that it could be reaching?
Any comments welcome.
Regards
Craig
7 Replies
- CraigM_17826
Altocumulus
Hi everyone,
here's an update. When I look at the stats for iRules, I'm seeing a very high rate of failures logged against our HTTP based iRule for HTTP_REQUEST event types. Here are the stats
Total Executions: 1651
Failures : 1635
I am not seeing any errors for the iRule that handles the HTTPS connections, just the rule that handles the initial HTTP connections. Is there any way of tracking down what is causing these errors in the iRule? All the rule for HTTP based connections does are simple redirects, nothing fancy so I'm a little confused about this one.
Regards
Craig - hoolio
Cirrostratus
Are there multiple redirects that could possibly be hit in one or more rules attached to the VIP? Can you post the full rule(s) you're using?
Aaron - CraigM_17826
Altocumulus
Ok, Wschultz, your suggestions were spot on. I've also gone over some of the tests and they were in fact doubling up.
Although the sample iRule you supplied worked, it's scope was a little to broad, basically anything with our hostname was redirected. (I realise my original iRule did this, but it was an oversight) Whilst this can be good, I'm not sure if this is the exact behaviour we want, so I'm tossing up between what you suggested and this
if {[HTTP::uri] equals "/"}{
HTTP::redirect "https://mycomp.com.au/wps/portal"
return 0
}
this seems to work fine for these
http://mycomp.com.au
http://mycomp.com.au/
and generates a typical URL not found for
http://mycomp.com.au/dddd
as apposed to redirecting to https://mycomp.com.au/wps/portal as your suggestion does.
I think the return 0 statement fixed the reported errors issue though.
I'll take your advice and look at using switch where I can as apposed to 10 or so if blocks I currently have.
Once again, many thanks
Craig - Wil_Schultz_101
Nimbostratus
So, I'm not entirely sure what you are trying to accomplish. Regarding the 'equals /' statement, that will only redirect a 'GET /'. I you are attempting to redirect everything you can change it to 'starts_with /' and that would grab 'GET /dddd' as well. Is that what you are trying to do?if {[HTTP::uri] starts_with "/"} { HTTP::redirect "https://mycomp.com.au/wps/portal" return 0 } - CraigM_17826
Altocumulus
Hi Wschultz,
not quite. What I am trying to do is to redirect
http://mycomp.com.au
http://mycomp.com.au/
http://mycomp.com.au/wps/portal
http://mycomp.com.au/wps/portal/
all to https://mycomp.com.au/wps/portal
If anyone appends anything else to these base URLs then I do not want them redirected, I have a catch all redirect to our corperate 404-Not-Found page.
I know it might appear a little odd, but that's the spec I've been given.
Craig - Kirk_Bauer_1018
Altostratus
You don't have to worry about "http://mycomp.com.au" as the browser will always at least send a / as the URI. I would just do an if statement:
if { ([HTTP::uri] equals "/") or ([HTTP::uri] equals "/wps/portal") or ([HTTP::uri] equals "/wps/portal/") } {
HTTP::redirect "https://mycomp.com.au/wps/portal/"
}
(I probably have syntax errors in there, but you get the idea I think) - CraigM_17826
Altocumulus
A big thanks to wschultz and kirkbauer, I'm testing out these rules in our test environment now. If all goesw well I'll push them out to production.
Thanks for taking time out to help a relative newbie with this.
Regards
Craig
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