Forum Discussion
Thomas_McLean_1
Nimbostratus
Jan 14, 2016missing close-brace issue - iRule newbie
Hi,
I'm developing an iRule that will stop redirect users if they hit a specific URI, I'm needing to put this in the top of my current iRule so that it captures the request at the top to capture t...
iaine
Nacreous
Jan 14, 2016It also looks like you are missing an open { at the end of you opening if statement and the a corresponding close. Also, you've missed a : from a HTTP::uri. The code below should now hopefully save.
when HTTP_REQUEST {
set requestedHost [HTTP::host]
if { ([HTTP::uri] starts_with "/URI1") || ([HTTP::uri] starts_with "/URI2") || ([HTTP::uri] starts_with "/URI3") || ([HTTP::uri] starts_with "/URI4") || ([HTTP::uri] starts_with "/URI5") || ([HTTP::uri] starts_with "/URI6")} {
Static content is available on paths beginning /web and should be routed to a specific pool
if { [HTTP::uri] starts_with "/web" } {
if { [active_members hda_twss_web_pool] < 1 } {
log local0. "No pool member a available in hda_twss_web_pool"
HTTP::redirect "http://www.wheatly-group.com"
return
} else {
pool hda_twss_web_pool
log local0. "Sending to pool hda_twss_web_pool"
return
}
} elseif { not( [HTTP::uri] starts_with "/path/" ) } {
Application Content
Rewrite the uri based on a host match
switch [HTTP::host] {
"t-my.site.org" {
HTTP::uri "/path/to/features/AAtheme[HTTP::uri]"
}
"t-my.site2.org" {
HTTP::uri "/path/to/features/BBtheme[HTTP::uri]"
}
"t-my.site3.org" {
HTTP::uri "/path/to/features/CCtheme[HTTP::uri]"
}
"t-my.site4.org" {
HTTP::uri "/path/to/features/DDtheme[HTTP::uri]"
}
"t-my.site5.org" {
HTTP::uri "/path/to/features/EEtheme[HTTP::uri]"
}
"t-my.site6.org" {
HTTP::uri "/path/to/features/FFtheme[HTTP::uri]"
}
}
pool hda_twss_web_pool
log local0. "URI rewrite to HTTP::uri"
}
}
}
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] } {
HTTP::cookie domain JSESSIONID "$requestedHost"
HTTP::cookie path JSESSIONID "/"
}
}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