Forum Discussion
Maintanance Irule two issues
Hi there,
We've build a cool 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"
return 0
}
}
}
This seems to work fine but there are several issues though. The first issue, and that's why I've put the "return 0" in, is the combinantion with multiple Irules. Allthough I've put the return 0 in, I still see (In the logging) the next Irule is being hit and therefore the maintanance doesn't show. So I have to remove all irules from the VS and just put the maintanance Irule on Why?
The second issue is for example I put the maintanance on a VS which listens to www.x.com So when I type www.x.com the maintanance page shows up. But for example when I type in www.x.com/something , the maintance text shows up but the images aren't shown. I would like to see the images when I type www.x.com/something. Is there a way to optimize this Irule to achieve this?
21 Replies
- nathe
Cirrocumulus
heskez,
Just a comment about your first point and the other iRules firing. It's my understanding that the connection won't see individual iRules, as they all get compiled. As iRules are event based then all similar events across the iRules will be grouped together i.e. all HTTP_REQUESTS before any HTTP_RESPONSE events. The order of the iRule can order which commands fire first within similar events, or you can use the Priority Command on an event.
Hope I explained this sufficiently and gives you a bit of an insight.
Rgds N
- heskez_36146
Nimbostratus
Thanks for explaining nathan. I ordered the irules on the vs so the first one is the maintanance page irule. But if I understand you correctly, if the second irule contains a HTTP_REQUEST it will be hit?
- heskez_36146
Nimbostratus
Thanks Nathan for explaining. And how about the second issue we get? :)
- What_Lies_Bene1
Cirrostratus
Regarding the second issue, I'd suggest initially removing the 'return 0' from your rule. After that, if there's no difference your best bet would be to do a packet capture client side and take a closer look at the request/response sequence.
- IheartF5_45022
Nacreous
Does your error.html have relative pathnames ? A browser developer tool will probably help you here (or HTTPWatch - that's my fav tool apart from Wireshark).
- heskez_36146
Nimbostratus
Thanks, I'm trying HTTPWatch right now, very cool tool!
- heskez_36146
Nimbostratus
When I investigate with Element inspect from Google the location of the Ifile seems allright. I try to investigate further but I'm afraid that I'm stuck here.
- nitass
Employee
The first issue, and that's why I've put the "return 0" in, is the combinantion with multiple Irules. Allthough I've put the return 0 in, I still see (In the logging) the next Irule is being hit and therefore the maintanance doesn't show. So I have to remove all irules from the VS and just put the maintanance Irule on Why?
you need event disable command.
event wiki
https://devcentral.f5.com/wiki/iRules.event.ashxiRules: Disabling Event Processing by Deb Allen
https://devcentral.f5.com/articles/irules-disabling-event-processing.Us2X4bSjbIUThe second issue is for example I put the maintanance on a VS which listens to www.x.com So when I type www.x.com the maintanance page shows up. But for example when I type in www.x.com/something , the maintance text shows up but the images aren't shown. I would like to see the images when I type www.x.com/something. Is there a way to optimize this Irule to achieve this?
the image is not shown because the image request also contains /something (e.g. /something/logo.gif). the /something is included because you do not change url at client.
for workaround, you may adjust switch pattern (e.g. using glob-style matching) but you have to make sure it won't conflict with server's url.
hope this helps.
- heskez_36146
Nimbostratus
Thanks Nitass, so when I use something like this in mu irule it should show the images? set RequestedPath [string tolower [HTTP::path]] switch $RequestedPath { "/" { HTTP::respond 200 content [ifile get error.html] "Content-Type" "text/html" } }
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