Forum Discussion
Maintenance to ifile irule doesnt work
Hi Guys, I have a two sets of LTMs in datacenters (SEA and LHR). I need to setup a maintenance page in LHR datacenter to present a page when VIPs in SEA datacenters go down. I am pretty new to IRULEs but read through the guides for ifiles and irules and came up with a static way of setting the irule on a VIP: created a VIP on LHR LTMs created an a record for that VIP - x.x.x.x mapped to maintenance.x.com so that I can manually change a record to all domains I would like to point to ifile maint. page there... uploaded a simple htm file with maintenance note in to ifiles folder (through GUI so its in /common) named the ifile: maintenance_htm mapped the ifile to an ifile list in irule: maintance_htm created an irule (named maintenance_page) to catch all instances and subdomains of .x.com and redirect to my ifile: when HTTP_REQUEST { if { [HTTP::uri] contains ".x.com" } { HTTP::respond 200 content [ifile get maintance_htm ] }} added the IRULE to the maintenance.x.com VIP.... doesn't work... I spoke with support and was advised to add the path to the file itself:
HTTP:Respond 200 ifile "/Common/ifileURL"
but from what I understand if the file is already in /common you don't have to do it... when I add: HTTP:Respond 200 ifile "/Common/maintenance_htm" it through parser error at me anyway....
any advice how to troubleshoot this ?
- Mohamed_LrhaziAltocumulusNot sure I understand the big picture that you are describing... So in data center SEA, you have some VIPs. When they go down, (meaning all the members of their pools are down? or when Internet user cannot access them?), then you redirect, via an iRule to a special maintenance page URL. This URL is hosted on a VIP in data center LHR, right? This latter VIP's job is to simply return some static content, via iFiles? you only question/problem is that the iRule is not returning the correct iFile content? Why is the iRule testing the URI? just return the content regardless of URI, no? Whenyou say it does not work, what does it mean? also, do you see any errors in the log when the requests are handled?
- LeonK_146224NimbostratusI think I over complicated the explanation: in our case it would be a simple maintenance page, loaded and served as an ifile from the ltms. with the above state irule on a VIP that should serve just as a redirection VIP. I will setup to change an A record to all the domains that I want this page to appear on. makes sense?
- JRahmAdmin
iFiles have two places of configuration, adding the file itself to the system (System->File Management->iFile List) and then making it accessible to an iRule (Local Traffic->iRules->iFile List). If you only use one partition, you can don't need the folder reference on your iFile call. My iRule for serving up html pages (with css/js and images) looks like this:
when HTTP_REQUEST { if { [active_members appPool1] == 0 } { HTTP::respond 200 content [ifile get "mtce_html"] "Content-Type" "text/html" } switch $path { "/css/mtce.css" { HTTP::respond 200 content [ifile get "mtce_css"] "Content-Type" "text/css" return } "/img/mtce.png" { HTTP::respond 200 content [ifile get "mtce_img"] "Content-Type" "image/png" return } "/js/mtce.js" { HTTP::respond 200 content [ifile get "mtce_js"] "Content-Type" "text/javascript" return } } }
- JGCumulonimbus
LeonK: What do you think "HTTP::uri" returns? Print the output to log and you might know what's wrong with your irule. :-)
- Mohamed_LrhaziAltocumulusHere is what you need to do: - Reproduce the problem with a curl command, and show its full output. - Show full text of your iRule. That would help people understand and be able to help you out.
- JVK_45053Altostratus
When i add the irule to VS i am getting error: Unable to find ifile i have two partition and i am providing the path like /Common/file.html
- JVK_45053Altostratus
Its my mistake i didn't map it in irule -> ifile
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