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"
}
}
}
}
- nitass_89166Noctilucent
may you add some logging (e.g. uri) in the irule?
- Bart_18836NimbostratusSure I can , I was wondering however what to log , I mean , there is a way to log ifile attributes etc but not sure if this is what you ask to log or do you mean http requests from clients ?
- nitassEmployee
may you add some logging (e.g. uri) in the irule?
- Bart_18836NimbostratusSure I can , I was wondering however what to log , I mean , there is a way to log ifile attributes etc but not sure if this is what you ask to log or do you mean http requests from clients ?
- nitass_89166Noctilucent
do you mean http requests from clients ?
sorry not to explain well. yes, i mean request from client (i.e. uri). i suspect uri may not match switch case.
- Bart_18836NimbostratusI have edited code (sorry for formatting, code didn's want to merge so I had to add ugly spaces ;)) I see only one request, shoudn't I see all 3 for other objects ? Apr 28 14:03:51 LB01 info tmm1[11145]: Rule /Common/irule_SORRYPAGE : HTML: Requested Hostname: 10.80.6.3 URI: /sorrypage
- nitassEmployee
do you mean http requests from clients ?
sorry not to explain well. yes, i mean request from client (i.e. uri). i suspect uri may not match switch case.
- Bart_18836NimbostratusI have edited code (sorry for formatting, code didn's want to merge so I had to add ugly spaces ;)) I see only one request, shoudn't I see all 3 for other objects ? Apr 28 14:03:51 LB01 info tmm1[11145]: Rule /Common/irule_SORRYPAGE : HTML: Requested Hostname: 10.80.6.3 URI: /sorrypage
- nitassEmployee
I see only one request, shoudn't I see all 3 for other objects ?
that means image request does not match switch case.
so, can you move the logging command to be before the if statement?
- Bart_18836NimbostratusNitass, any chance you could have a glance again ? There is no issue with CaSe , I have confirmed it by rewriting code and uploading files again with lower case names, this is what i see in logs : May 13 14:28:02 US3MSOLB01-1 info tmm[11106]: Rule /Common/irule_VHQ_UI-SORRYPAGE : HTTP_REQ: Requested Hostname: vhqint.verifone.com URI: /sp May 13 14:28:02 US3MSOLB01-1 info tmm[11106]: Rule /Common/irule_VHQ_UI-SORRYPAGE : HTTP_REQ: Requested Hostname: vhqint.verifone.com URI: /background May 13 14:28:02 US3MSOLB01-1 info tmm1[11106]: Rule /Common/irule_VHQ_UI-SORRYPAGE : HTTP_REQ: Requested Hostname: vhqint.verifone.com URI: /logo
- nitass_89166Noctilucent
I see only one request, shoudn't I see all 3 for other objects ?
that means image request does not match switch case.
so, can you move the logging command to be before the if statement?
- Bart_18836NimbostratusNitass, any chance you could have a glance again ? There is no issue with CaSe , I have confirmed it by rewriting code and uploading files again with lower case names, this is what i see in logs : May 13 14:28:02 US3MSOLB01-1 info tmm[11106]: Rule /Common/irule_VHQ_UI-SORRYPAGE : HTTP_REQ: Requested Hostname: vhqint.verifone.com URI: /sp May 13 14:28:02 US3MSOLB01-1 info tmm[11106]: Rule /Common/irule_VHQ_UI-SORRYPAGE : HTTP_REQ: Requested Hostname: vhqint.verifone.com URI: /background May 13 14:28:02 US3MSOLB01-1 info tmm1[11106]: Rule /Common/irule_VHQ_UI-SORRYPAGE : HTTP_REQ: Requested Hostname: vhqint.verifone.com URI: /logo
- What_Lies_Bene1Cirrostratus
Probably an issue with CaSe with the images and/or, the if statement should be 'starts_with' not equals.
- Bart_18836Nimbostratus
So I did following, enabled logging before if statement and edited ifiles to use just lower case. Replaced ifiles objects. Current logs look like that :
Apr 29 14:04:26 LB01 info tmm[11106]: Rule /Common/irule_SORRYPAGE : HTTP_REQ: Requested Hostname: 10.80.6.3 URI: /sorrypage
Apr 29 14:04:26 LB01 info tmm[11106]: Rule /Common/irule_SORRYPAGE : HTML: Requested Hostname: 10.80.6.3 URI: /sorrypage
Apr 29 14:04:26 LB01 info tmm1[11106]: Rule /Common/irule_SORRYPAGE : HTTP_REQ: Requested Hostname: 10.80.6.3 URI: /background
Apr 29 14:04:26 LB01 info tmm[11106]: Rule /Common/irule_SORRYPAGE : HTTP_REQ: Requested Hostname: 10.80.6.3 URI: /logo
- nitass_89166Noctilucent
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_18836NimbostratusI 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_89166Noctilucentyes, it should work. :)
- Bart_18836NimbostratusThanks Nitass. Seems to me that there is some problems with iFiles. Going to check with F5.
- nitassEmployee
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_18836NimbostratusI 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 ?
- nitassEmployeeyes, it should work. :)
- Bart_18836NimbostratusThanks Nitass. Seems to me that there is some problems with iFiles. Going to check with F5.
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