Forum Discussion
Kevin_Stewart
Apr 24, 2013Employee
Assuming 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.