Forum Discussion
breasoner_11658
Mar 02, 2012Nimbostratus
One more try at the iRule text. Am I adding too much info at once?
when HTTP_REQUEST {
The Wfm3g Datagroup List
set DATA_GROUP_LIST QA-Multiple-Portal
Get the request Host
set host [HTTP::host]
Get the URI
set uri [string tolower [HTTP::uri]]
The Wfm3g session cookie name
set wfm3g_cookie_name "JSESSIONID"
The Jasper Server session cookie name
set jasper_cookie_name "JASPERSESSIONID"
The JasperServer web context
set jasperreports_uri "/jasperserver-pro"
The JasperServer is down URL
set jasperisdownurl "/ute/jsp/reportingServerUnavailable.jsp"
The default JasperServer Pool name. Used if one is not specified
in the data group list for the client.
set DEFAULT_JASPER_POOL "Default-Jasper-Pool"
3G wfm context
set wfm3g_wfm_uri "/wfm"
Script Resource context
set scriptresource_uri "/scriptresource.axd"
Web Resource context
set webresource_uri "/webresource.axd"
Portal context
set portal_uri "/portal"
set DEFAULT_PORTAL_POOL "Portal-PMQA-Pool"
Layouts context
set layouts_uri "/_layouts"
Set Header information
set WLheader "WL-Proxy-SSL"
set WLheaderVal "true"
Retrieve the list of pools from the data group list
set clientPoolList [ findclass $host $DATA_GROUP_LIST " " ]
Route requests to Portal.
if { $uri starts_with $portal_uri }{
HTTP::header insert $WLheader $WLheaderVal
Identify the Portal pool
set portal_pool [getfield $clientPoolList " " 3]
log local0.notice "Forwarding to Portal pool: $portal_pool. Uri: $uri"
pool $portal_pool
return
} elseif { $uri starts_with $layouts_uri }{
HTTP::header insert $WLheader $WLheaderVal
log local0. "Inserting $WLheader: [HTTP::header value $WLheader]"
Identify the Portal pool
set portal_pool [getfield $clientPoolList " " 3]
log local0.notice "Forwarding to Portal pool: $portal_pool. Uri: $uri"
pool $portal_pool
return
} elseif { $uri starts_with $scriptresource_uri }{
HTTP::header insert $WLheader $WLheaderVal
Identify the Portal pool
set portal_pool [getfield $clientPoolList " " 3]
log local0.notice "Forwarding to Portal pool: $portal_pool. Uri: $uri"
pool $portal_pool
return
} elseif { $uri starts_with $webresource_uri }{
HTTP::header insert $WLheader $WLheaderVal
Identify the Portal pool
set portal_pool [getfield $clientPoolList " " 3]
log local0.notice "Forwarding to Portal pool: $portal_pool. Uri: $uri"
pool $portal_pool
return
Route requests to Jasper.
} elseif { $uri starts_with $jasperreports_uri }{
Identify the Jasper pool
set jasper_pool [getfield $clientPoolList " " 2]
If Jasper pool is not explicitly set for the client, use default
if { $jasper_pool eq "" }{
set jasper_pool $DEFAULT_JASPER_POOL
}
Make sure there is at least one Jasper server running
if { [active_members $jasper_pool] < 1 } {
HTTP::redirect $jasperisdownurl
} else {
log local0.notice "Forwarding to Jasper Report pool: $jasper_pool. Uri: $uri"
pool $jasper_pool
return
}
Route WFM requests to 3G Pool
} elseif { $uri starts_with $wfm3g_wfm_uri }{
set wfm3g_pool [getfield $clientPoolList " " 1]
log local0.notice "Forwarding to WFM3G pool: $wfm3g_pool. Uri: $uri"
pool $wfm3g_pool
return
} elseif { $uri equals "/" }{
HTTP::uri "/wfm"
set wfm3g_pool [getfield $clientPoolList " " 1]
log local0.notice "BLANK URI - Forwarding to WFM3G pool: $wfm3g_pool. Uri: $uri"
pool $wfm3g_pool
return
} else {
Identify the 3G pool
set wfm3g_pool [getfield $clientPoolList " " 1]
foreach header {WL-Proxy-SSL} {
log local0. "Removing $header: [HTTP::header value $header]"
HTTP::header remove $header
log local0.notice "Forwarding to WFM3G pool: $wfm3g_pool. Uri: $uri"
pool $wfm3g_pool
return
}
}
}
when HTTP_RESPONSE {
Secure the outbound Wfm3g cookie.
if { [HTTP::cookie exists $wfm3g_cookie_name] } {
HTTP::cookie secure $wfm3g_cookie_name enable
}
Secure the outbound JasperServer cookie.
if { [HTTP::cookie exists $jasper_cookie_name] } {
HTTP::cookie secure $jasper_cookie_name enable
}
}