Forum Discussion
Mojdeh_Koushki_
Nimbostratus
Oct 14, 2005iRule Script in Ver 9 is not functioning
hello
here is my problem, i have a set of bigip for bunch of web farm on ver 4.5.10, which i have this iRule for it and it is functioning Very Well...
if (getfield(http_uri, '/', 2) matches_regex "[Ww][Ee][Bb][Aa][Pp][Pp]") {
redirect to "https://%h/%u"
}
else {
use pool WebApp-50
}
and now we are upgrading to version 9 and compatable iRule for version 9 is COMPILING but NOT FUNCTIONING ...
here is the script...
when HTTP_REQUEST {
if { [string tolower [getfield [HTTP::uri] '/' 2]] == "webapp" } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
} else {
pool POOL_HTTP_Vlan70
}
}could you please tell me WHY?
thanks alot
Mojdeh
51 Replies
- Mojdeh_Koushki_
Nimbostratus
so here is the resault :
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:10 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:14 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:14 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:36 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:40 tmm tmm[628]: Rule coline : No match, forwarding to the pool
Oct 17 18:23:40 tmm tmm[628]: Rule coline : No match, forwarding to the pool
this time is not in the loop but not redirecting to https - Colin_Walker_12Historic F5 AccountI really need more information to be able to make any kind of deduction.
Specifically...was this a succesful request, or did it "freeze" again? When you made the request, were you using the http address, or https?
Sharing more information about the situation and the results would be very helpful.
-Colin - Mojdeh_Koushki_
Nimbostratus
it's not freezzing again nor redirecting to https
what time of info do you what ...do you want qkview file ?
i will send you any info which would help? do you wnat to test the website to get the feeling of it? - Colin_Walker_12Historic F5 AccountThe only reason that it wouldn't redirect to HTTPS would be if the URI doesn't match, or the request isn't coming in on port 80.
Are either of those the case?
-Colin - Mojdeh_Koushki_
Nimbostratus
what else are you looking for ... do you want to have access to the box ?
Colin, we know there is a loop for the statment, if the " IF " statment is false or true ... so problem is the code is in the loop and can not get back to the main process which is using the pool , if i am not mistaken .
so how about this :
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { ($uri starts_with "/webnav") or ($uri starts_with "/webapp") } {
log local0. "URI matches, and Port matches, redirecting to HTTPS"
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
} else {
log local0. "No match, forwarding to the pool"
}
pool POOL_HTTP_Vlan70
} - Mojdeh_Koushki_
Nimbostratus
first let's fixed the loop ... i think problem is that area - Colin_Walker_12Historic F5 AccountYou said, just after posting your most recent log excerpts that the rule was no longer looping. The log information from that post supports this statement.
The loop is what was causing the "freezing" effect you were speaking of. If it is no longer freezing, and your requests are being handled properly (even if they're not being redirected), then the rule is not stuck in a loop. This is my understanding currently.
This is why I asked the questions I did. You said that it is no longer looping, but now it won't redirect to HTTPS.
As I said...the only reason it wouldn't perform the redirect, would be if either the URI, or port didn't match.
-Colin - Mojdeh_Koushki_
Nimbostratus
here is the test with pool POOL_Vlan70 as last sentence
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTPS
Oct 17 19:01:17 tmm tmm[675]: Rule coline : URI matches, and Port matches, redirecting to HTTP
some how the loop is generating - Mojdeh_Koushki_
Nimbostratus
sorry .... probebly we are not in same page
there is a loop if url is correct and port is currect and there is a loop if port is not currect
sorry i explain it wrong , when we add tcp port to if statment, it couased to paypass the iRule and get to other steps of the application
sorry for my miss expalining - Colin_Walker_12Historic F5 AccountWhat do you mean with the pool as the last sentence? Did you modify the rule I posted? If so...please don't. I'm trying to rule out what could be going wrong. If you're modifying things that I can't see, I'm never going to be able to track down what's happening.
If you are using the most recent rule I posted, it shouldn't be possible for that loop to exist, as the rule I posted checked the TCP port the request was coming in for before performing the redirect. You said yourself that when you implemented the updated rule, the loop stopped happening, and the redirection stopped occuring.
Please stop updating things without re-posting the rule you're currently working with.
As far as I know, since you haven't updated me, I'm under the impression you are still using this rule:when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] if { (($uri starts_with "/webnav") or ($uri starts_with "/webapp")) and ([TCP::local_port] == 80) } { log local0. "URI matches, and Port matches, redirecting to HTTPS" HTTP::redirect "https://[HTTP::host][HTTP::uri]" } else { log local0. "No match, forwarding to the pool" pool POOL_HTTP_Vlan70 } }
The log you included doesn't seem to reflect that, as that loop shouldn't be possible with this rule. This should provide the exact functionality you asked for. It checks the URI, and the TCP port. It redirects to https if it's not already, and passes to the normal pool if it doesn't match those requirements.
-Colin
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