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?
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.
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?
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.
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).
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.
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
iRules: Disabling Event Processing by Deb Allen
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 something (@something) / X , the maintance text shows up but the images aren’t shown. I would like to see the images when I type something (@something) / X. 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.
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” } }
Thanks Nitass, I’ve put an “event disable” in front of every section and now I can clearly see the maintanance page comes up with the images shown, it works great! So the first issue is resolved.
Concerning the second issue, most people have some favorite in their browser, so when they click there’s something like www.x.com/application/eninge the images of the maintanance page doesn’t show up. When I type www.x.com/application the images do show up! So, we’re almost there. So I’d like in the Irule something like redirect /application/engine to root path www.x.com. That would probably solve it. Is this the correct syntax?
set RequestedPath [string tolower [HTTP::path]] switch $RequestedPath { "/" { HTTP::respond 200 content [ifile get error.html] "Content-Type" "text/html" } }