Forum Discussion
Help with iRule to redirect to maintenance page with pool is down
I am trying to configure a static page to display if all nodes in a pool go down. I have imported my code into an iFile and I have applied that file to the iRule. elow is my iRule code.
when HTTP_REQUEST { if {[active_members [LB::server pool]] < 1} {
HTTP::respond 200 content [ifile get "down_html"] } }
When I apply the iRule as a resource I get an error that states unable to find ifile(down_html) referenced at line 3: [ifile get "down_html"]
Any help would be greatly appreciated.
7 Replies
- Kevin_Stewart
Employee
Try including the entire path to the ifile (its partition):
[ifile get "/Common/down.html"] - ewest111
Nimbostratus
That worked, however it brought up another issue. As you can tell I'm new to the iRules world....I have two profiles for my server pool. One that serves HTTP and one that serves HTTPS. When I apply the above iRule on the https virtual server I get the following:
01070394:3: HTTP_REQUEST event in rule (/Common/Cokes_Redirect) requires an associated HTTP or FASTHTTP profile on the virtual server (/Common/vs_testcokes_443).
- Kevin_Stewart
Employee
Right. You need to apply an HTTP profile and client SSL profile to the HTTPS VIP to make this iRule work.
- ewest111
Nimbostratus
The only profile (client) that is in the drop down list id the FastL4
- Kevin_Stewart
Employee
In order to use HTTP commands and events in an iRule, you need a virtual server type that support an HTTP profile (like the "Standard" type VIP). You must also terminate the SSL at the VIP with a client SSL profile (you can optionally re-encrypt).
- Kevin_Stewart
Employee
Do you also have an HTTP profile applied to the HTTPS VIP? Is the backend server listening on HTTPS, and if so do you have a server SSL profile applied to the VIP as well?
What happens if you remove the iRule (but leave it as a standard VIP with SSL profile(s))?
- Kevin_Stewart
Employee
Okay, so understand that in this mode the VIP is acting as an SSL proxy. You're doing SSL between the client and the VIP, so you need a client SSL profile on the VIP to handle that communication. You're also doing SSL on the server side, between the BIG-IP and the server, so you need a server SSL profile as well. There are two separate SSL sessions here - one between the client and BIG-IP, and one between the BIG-IP and server, so you need a separate client side and server side SSL profile applied to the VIP. For the iRule to work, you also need an HTTP profile applied to the virtual server. In most versions it's the fourth option down in the virtual server config under the "Configuration" section.
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