Forum Discussion
irule maintanance with redirection produces error
This is the situation:
We've following maintanance Irule (with your help much appreciated):
when HTTP_REQUEST {
switch [HTTP::uri] {
"/index.css" {
HTTP::respond 200 content [ifile get index.css] "Content-Type" "text/css"
}
"/logo.gif" {
HTTP::respond 200 content [ifile get logo.gif] "Content-Type" "image/gif"
}
default {
HTTP::respond 200 content [ifile get error.html] "Content-Type" "text/html"
}
}
}
This matches our expectations on following url:
"https://www.y.com/GoSouth" "https://www.y.com/GoWest" Now we want to apply redirection and show the maintanance as well.
We apply redirection on following url:
With following irule:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"*gosouth*" {
add the redirect link ie "www.xyz.com"
HTTP::redirect "https://www.y.com/GoSouth"
}
default {
add the default action you prefer ie "www.def.com"
HTTP::redirect "https://www.y.com/GoWest"
}
}
}
We applied the redirection irule on the www.x.com
Redirection works but doesn't show the images.So we made a change in the redirection irule:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"*gosouth*" {
add the redirect link ie "www.xyz.com"
HTTP::redirect "https://www.y.com/GoSouth"
}
default {
add the default action you prefer ie "www.def.com"
HTTP::redirect "https://www.y.com/"
}
}
}
Now the images of the maintanance pages are visible on url:
"https://www.y.com/GoSouth" "https://www.y.com/GoWest"
But when we go to https://www.x.com -> redirected to https://www.y.com we get an "connection reset" error in the browser.
Any idea what's causing this? and which irule is responsible?
6 Replies
- What_Lies_Bene1
Cirrostratus
You can't redirect AND serve files, it's one or the other. I can't see why you might actually send the files though?
- heskez_36146
Nimbostratus
What you suggest is to put maintanance on both VIPS? Instead of redirect from one to another?
- What_Lies_Bene1
Cirrostratus
It wasn't clear there are two Virtual Servers involved. That being the case can you please provide some detail on which rule is applied to which VS please.
- Kevin_Stewart
Employee
I think I understand what you're doing. If I'm reading your iRules correctly, any access to www.x.com will get redirected to "www.y.com", but may get the "/GoSouth" URI if the request contains "gosouth" (otherwise send to "/" or "/GoWest" - not sure which though). This logic would preclude any error messaging to the www.x.com VIP because all access to that VIP would get redirected to www.y.com. If this in in fact the case, then you only need the redirect iRule on the www.x.com VIP and the maintenance iRule only on the www.y.com VIP.
- heskez_36146
Nimbostratus
Thanks WLB and KS
"then you only need the redirect iRule on the www.x.com VIP and the maintenance iRule only on the www.y.com VIP."
This is our situation right now. When I put maintanance on the Y VIP and let the redirection irule apply on X VIP I get en error when I try to access the page.
- Kevin_Stewart
Employee
That sort of makes sense. Based on the maintenance iRule you're using, all requests not for /index.css or /logo.gif should be served the error page from the iFile. There's no option to pass traffic to an application server behind the VIP. Is that what you're seeing? If not, are you getting any error messages in the LTM log?
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