Forum Discussion
Error page iRules
I have recently been tasked with maintaining an F5 implementation and i am looking into how to develop iRules for error pages (maintenance, 404 etc).
My issue is that instead of having the html within the iRule itself i want to have the page written in an iFile that i then reference within each iRule.
I can get this to work (to an extent!) however i cannot get any images to show. Do i have to use data group lists for this?
Please bear in mind that i am a bit of a novice so any replies will need to be easy to understand!
Thanks
- nitassEmployeeI can get this to work (to an extent!) however i cannot get any images to show. Do i have to use data group lists for this?no, data group is not needed. you are using HTTP::respond and ifile similar to the article below, aren't you? can you post the irule?
- Kevin_StewartEmployeeTake a look at this recent thread:
- AliMack85_11443NimbostratusThanks for the speedy replies!
- Kevin_StewartEmployeeiFile was introduced in 11.1.0. Which TMOS version are you running?
- What_Lies_Bene1CirrostratusLots of mistakes, here's my corrections plus switching from if to switch;
when HTTP_REQUEST { switch { [string tolower [HTTP::uri]] } { "/" { HTTP::respond 200 content [ifile get errorpage.txt] "Content-Type" "text/html" } "/image01_en.png" { HTTP::respond 200 content [ifile get image01_en.png] "Content-Type" "image/png" } } }
- AliMack85_11443NimbostratusThe version we are using is 11.3.0
- What_Lies_Bene1CirrostratusEven more corrections, no need for file extensions, no quotes around Content-Type;
when HTTP_REQUEST { switch { [string tolower [HTTP::uri]] } { "/" { HTTP::respond 200 content [ifile get "errorpage"] Content-Type "text/html" } "/image01_en.png" { HTTP::respond 200 content [ifile get "image01_en"] Content-Type "image/png" } } }
- AliMack85_11443NimbostratusFantastic, got it to work!
- What_Lies_Bene1CirrostratusGreat, you're welcome.
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