Forum Discussion
SorryPage with iFiles on 11.3 HF8
Here is my problem, I have uploaded files via "System ›› File Management : iFile List" , created references under "Local Traffic ›› iRules : iFile List" , wrote an iRule for maintenance page and ttached iRule to one of my virtual servers, however it seems that pictures are not loaded at all. Can you have a look and tell me what can be wrong (although all looks ok to me). All object names and file names are exactly the same to avoid mistakes or typeos in code
iRule code :
when HTTP_REQUEST {
log local0. "HTTP_REQ: Requested Hostname: [HTTP::host] URI: [HTTP::uri]"
if { [HTTP::uri] eq "/sp" } {
switch [HTTP::uri] {
"/sp" {
HTTP::respond 200 content [ifile get "index"] "Content-Type" "text/html"
}
"/logo" {
HTTP::respond 200 content [ifile get "logo"] "Content-Type" "image/png"
}
"/background" {
HTTP::respond 200 content [ifile get "background"] "Content-Type" "image/jpeg"
}
}
}
} 25 Replies
- nitass
Employee
There is no issue with CaSe , I have confirmed it by rewriting code and uploading files again with lower case names
since there is if-statement (HTTP::uri eq /sp) before switch, /logo and /background won't hit the switch-case (because it is not equal to /sp).
if { [HTTP::uri] eq "/sp" } { switch [HTTP::uri] { "/sp" { HTTP::respond 200 content [ifile get "index"] "Content-Type" "text/html" } "/logo" { HTTP::respond 200 content [ifile get "logo"] "Content-Type" "image/png" } "/background" { HTTP::respond 200 content [ifile get "background"] "Content-Type" "image/jpeg" } } }- Bart_18836
Nimbostratus
I will test it today , but then all request will go to sorrypage and I wanted to specify some URI so I can test if that sorrypage works or not while not affecting production (I can test it on seperate vip though). But if I still want to test on the same vip, then if I replace "eq" with "start_with" and in my "switch" sections I change /logo and /background to /sp/logo and /sp/background (before that I will have to edit my html code of course) , will this actually work ? - nitass
Employee
yes, it should work. :) - Bart_18836
Nimbostratus
Thanks Nitass. Seems to me that there is some problems with iFiles. Going to check with F5.
- Kevin_Stewart
Employee
since there is if-statement (HTTP::uri eq /sp) before switch, /logo and /background won't hit the switch-case (because it is not equal to /sp)
Correct. You should just need to remove the if layer:
when HTTP_REQUEST { log local0. "HTTP_REQ: Requested Hostname: [HTTP::host] URI: [HTTP::uri]" switch [HTTP::uri] { "/sp" { HTTP::respond 200 content [ifile get "index"] "Content-Type" "text/html" } "/logo" { HTTP::respond 200 content [ifile get "logo"] "Content-Type" "image/png" } "/background" { HTTP::respond 200 content [ifile get "background"] "Content-Type" "image/jpeg" } } } - Kevin_Stewart
Employee
So then just to level set, did you remove the initial if { [HTTP::uri] eq "/sp" } evaluation? What does the log statement report? Do you see the request for the /logo URI? How about some additional logging just to make sure:
when HTTP_REQUEST { log local0. "HTTP_REQ: Requested Hostname: [HTTP::host] URI: [HTTP::uri]" switch [HTTP::uri] { "/sp" { log local0. "catch /sp" HTTP::respond 200 content [ifile get "index"] "Content-Type" "text/html" } "/logo" { log local0. "catch /logo" HTTP::respond 200 content [ifile get "logo"] "Content-Type" "image/png" } "/background" { log local0. "/catch background" HTTP::respond 200 content [ifile get "background"] "Content-Type" "image/jpeg" } } } - Kevin_Stewart
Employee
This would suggest that the iRule is working and that perhaps the ifile is not. This is where a client side capture utility like Fiddler or HTTPWatch can be useful. I'm guessing that if you watch the traffic from the client side, you'll actually see a response to the image request, but the returned data won't be useful as an image.
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
