Thomas_McLean_1
Jan 14, 2016Nimbostratus
missing 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 the client in the first instance.
I've masked the corporate information, can anyone help with this? I've included the iRule and error message.
I'm pretty new to iRules so still getting used to syntax etc (new to scripting/programming too) since I am a network engieer.
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 "/"
}
}
And here is the error message - I've had to truncate some details within this also:
01070151:3: Rule [/Common/hda_uri_test] error: /Common/hda_uri_test:1: error: [parse error: missing close-brace][{
set requestedHost [HTTP::host]
Thanks for your time,
Tam.