Forum Discussion
Recursive HTTP redirection, why?
Hello,
I tried the following irule which had this idea
if i go to http://www.example.com/, then it should redirect to
http://www.example.com/_bla1bla2bla3?/
when HTTP_REQUEST {
if { [active_members my_pool] > 0 } {
if { not ([HTTP::uri] starts_with "/_bla1bla2bla3?")} {
HTTP::redirect http://thenest-eur-de.example.com/_bla1bla2bla3?[HTTP::uri]
return
}
} else {
HTTP::redirect http://whatever.com
return
}
}
- If I dont use the condition "if { not ([HTTP::uri] starts_with "/_bla1bla2bla3?")}" then i will get recursive HTTP 302 redirections on my browser, strange.....is it normal?? i thoguht that if i use return, then it doesnt come back to the iRule..
- do i need to bring all chars to lower case?
thanks for checking it, i am not a super-hero on irules (yet)!
Giulio
4 Replies
- nitass
Employee
1. If I dont use the condition "if { not ([HTTP::uri] starts_with "/_layouts/nestlepages/markethome.aspx?")}" then i will get recursive HTTP 302 redirections, is it correct?yes
e.g.[root@ve10:Active] config curl -IL http://thenest-eur-de.example.com/something HTTP/1.0 302 Found Location: http://thenest-eur-de.example.com/_bla1bla2bla3?/something Server: BigIP Connection: Keep-Alive Content-Length: 0 HTTP/1.0 302 Found Location: http://thenest-eur-de.example.com/_bla1bla2bla3?/_bla1bla2bla3?/something Server: BigIP Connection: Keep-Alive Content-Length: 0 ...snipped... HTTP/1.0 302 Found Location: http://thenest-eur-de.example.com/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/_bla1bla2bla3?/something Server: BigIP Connection: Keep-Alive Content-Length: 0 curl: (47) Maximum (50) redirects followed
2. do i need to bring all chars to lower case?if case is mixed, i think it is better to use string tolower before comparision. - Thank you very much for your valuable help!!
One last question. After I defined the HTTP redirection, shall i put the pool in the iRule itself or specify it in the LTM GUI?
I mean... i could add the line pool after the inner 'if'..... Thank you very much for your valuable help!!
One last question. After I defined the HTTP redirection, shall i put the pool in the iRule itself or specify it in the LTM GUI?
I mean... i could add the line pool after the inner 'if'.....
.....
HTTP::redirect http://thenest-eur-de.example.com/_bla1bla2bla3?[HTTP::uri]
pool mypool
return
....does it matter where i configure the pool? in the GUI or in the iRule?
- nitass
Employee
HTTP::redirect http://thenest-eur-de.example.com/_bla1bla2bla3?[HTTP::uri]
pool mypool pool won't be executed because HTTP::redirect already send response to client.
by the way, if my_pool is already assigned to the virtual server, you can adjust the irule something like this.when HTTP_REQUEST { if { [active_members [LB::server pool]] > 0 } { if { not ([HTTP::uri] starts_with "/_bla1bla2bla3?") } { HTTP::redirect "http://thenest-eur-de.example.com/_bla1bla2bla3?[HTTP::uri]" } } else { HTTP::redirect "http://whatever.com" } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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