Forum Discussion
gdoyle
Nov 01, 2018Cirrostratus
So this is how my irule now looks. I have added in the above and am hoping I did it correctly. I was hoping someone could look it over and point out any issues they see (if any)? I'm not 100% certain I inserted the above logging statement for the pool members accurately. My irule is based on one Kevin Stewart helped me here: https://devcentral.f5.com/questions?pid=61854.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/place/portal" -
"/place/portal/" -
"/" {
HTTP::respond 301 "Location" "https://www.my-website.com/portal/my-website-com"
}
"/redirect.nsf*" {
This section prints the active members in the SuperServers_pool to the logs
if this section of the irule is invoked.
set thispool "SuperServers_pool"
foreach { pmem } [members -list $thispool] {
log local0. "$thispool - [getfield $pmem " " 1] [LB::status pool $thispool member [getfield $pmem " " 1] [getfield $pmem " " 2]]"
}
This next section states that if there are more than 0 pool members are active in the SuperServers_pool
then the user is redirected there, else they are presented a Maintenance Page.
if { [active_members SuperServers_pool] > 0 } {
log local0. "Sending to the SuperServers_pool."
pool SuperServers_pool
} else {
log local0. "Sending to MX Page for the SuperServers_pool."
HTTP::respond 503 content [ifile get "/external/my-website_MaintenancePage_ifile"] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate"
return
}
}
"*/hrp/*" {
This section prints the active members in the PDFServers_Pool to the logs
if this section of the irule is invoked.
set thispool "PDFServers_Pool"
foreach { pmem } [members -list $thispool] {
log local0. "$thispool - [getfield $pmem " " 1] [LB::status pool $thispool member [getfield $pmem " " 1] [getfield $pmem " " 2]]"
}
This next section states that if there are more than 0 pool members are active in the PDFServers_Pool
then the user is redirected there, else they are presented a Maintenance Page.
if { [active_members PDFServers_Pool] > 0 } {
log local0. "Sending to the PDFServers_Pool."
pool PDFServers_Pool
} else {
log local0. "Sending to MX Page for the PDFServers_Pool."
HTTP::respond 503 content [ifile get "/external/my-website_MaintenancePage_ifile"] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate"
return
}
}
default {
This section prints the active members in the my-website.com_pool to the logs
if this section of the irule is invoked.
set thispool "my-website.com_pool"
foreach { pmem } [members -list $thispool] {
log local0. "$thispool - [getfield $pmem " " 1] [LB::status pool $thispool member [getfield $pmem " " 1] [getfield $pmem " " 2]]"
}
This next section states that if there are more than 0 pool members are active in the my-website.com_pool
then the user is redirected there, else they are presented a Maintenance Page.
if { [active_members my-website.com_pool] > 0 } {
log local0. "Sending to the my-website.com_pool."
pool my-website.com_pool
} else {
log local0. "Sending to MX Page for the my-website.com_pool."
HTTP::respond 503 content [ifile get "/external/my-website_MaintenancePage_ifile"] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate"
return
}
}
}
log local0. "Inserting HttpsIndicatorHeader Value"
HTTP::header insert HttpsIndicatorHeader True
}
- Simon_BlakelyNov 01, 2018Employee
That looks OK to me, but I haven't tested it.