Forum Discussion
pgsmith_120398
Altostratus
Apr 24, 2013Sorry Server iRule with iFiles
Hello,
I have been searching the forums, wiki, and web for more information about setting up an iRule that will utilize iFiles to deliver a sorry page using the HTTP::content command. I h...
Kevin_Stewart
Employee
Apr 24, 2013Assuming you have the iFiles in place (uploaded) and configured (assigned in the GUI), then you'd use a series of URI or path conditionals and the HTTP::respond command. Here's an example:
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
"/images/background.jpg" {
HTTP::respond 200 content [ifile get ] "Content-Type" "image/jpeg"
}
"/css/styles.css" {
HTTP::respond 200 content [ifile get ] "Content-Type" "text/css"
}
"/index.html" {
HTTP::respond 200 content [ifile get ] "Content-Type" "text/html"
}
}
}
The HTTP::respond command allows an arbitrary set of headers after the content, which allows you in this case to send the Content-Type header to the browser for proper rendering.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects