Forum Discussion
brianokelly_119
Nimbostratus
Mar 03, 2011iRule to serve image to user
Hi All,
We are trying to serve a 1MB image directly from a specific uri on a vip to test throughput up to the F5. As such we do not wish to put the base 64 encoded image data into the bigip.conf file, rather store it on the file system. I followed an example on the site but it does not seem to work (v10.2 on an 8900):
Class:
class logo_f5_class_t2 {
"filename" { "/var/class/f5.image.class" }
}
iRule:
when HTTP_REQUEST {
if {[HTTP::uri] eq "/preprodtestimage/image.jpg" }
{
HTTP::respond 200 content [b64decode [lindex $::logo_f5_class_t2 0]] "Content-Type" "image/jpg"
}
}
When loading the image directly in the response (b64 encoded) we have no issues. However, when we use the above we get page could not be displayed. Can anyone see anything obvious missing?
4 Replies
Sort By
- George_Watkins_Historic F5 AccountHi,
- brianokelly_119
Nimbostratus
Hi George, - hoolio
Cirrostratus
In 10.x, you can no longer access a datagroup directly as a TCL list. You can change [lindex $::class_name 0] to [class element -name 0 class_name]. - brianokelly_119
Nimbostratus
Hi hoolio,class logo_f5_class_t2 { "filename" { "/var/class/f5.image.class" } } rule TEST_IMG_t2 { when HTTP_REQUEST { if {[HTTP::uri] eq "/testimage/image.png" } { HTTP::respond 200 content [b64decode [class element -value 0 logo_f5_class_t2]] "Content-Type" "image/png" } } }
Mar 9 11:52:41 local/tmm6 err tmm6[6612]: 01220001:3: TCL error: TEST_IMG_t2 - conversion error invoked from within "b64decode [class element -value 0 logo_f5_class_t2]"
"R0lGODlhEgAeANUAABAREz9CSEBBQz0+QB8hJCIkJ5eZnGJlaXN2egQJDwUKEDo+Q0VJTgEDBQULEQUKDwMGCTo+Qk1RVUtPU0pOUk9TV1RYXFZaXlxgZFtfYy0vMRcYGTEzNR8gIW5xdG1wc2lsb2hrbklLTXh7fnV4e3R3enN2eXF0d4SHiqCipJeZmwQKDwULEDU6PktQVFtfYjI4PHN2eAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAEgAeAEAG20CRcEgsDjFIZGa5fDmTSId0Sq2yroqsdsvVnr5fk9gUK8fAX4Z6zW6vu3Duak6v2+mIfH7E7/P1eSGsDjFIZGa5fDmTSId0Sq2yroqsdsvVnr5fk9gUK8fAX4Z6zW6vu3Duak6v2+CggMdIIWHHYOCsDjFIZGa5fDmTSId0Sq2yroqsdsvVnr5fk9gUK8fAX4Z6zW6vu3Duak6v2+FY2NGhsSkJIbjsDjFIZGa5fDmTSId0Sq2yroqsdsvVnr5fk9gUK8fAX4Z6zW6vu3Duak6v2+o0RmJgEAC2bnQsDjFIZGa5fDmTSId0Sq2yroqsdsvVnr5fk9gUK8fAX4Z6zW6vu3Duak6v2+CZmFUuEA6kpqUsDjFIZGa5fDmTSId0Sq2yroqsdsvVnr5fk9gUK8fAX4Z6zW6vu3Duak6v2+OVyxcExAKrrCvsDjFIZGa5fDmTSId0Sq2yroqsdsvVnr5fk9gUK8fAX4Z6zW6vu3Duak6v2+W3auK7a2dSm7vL2+vCXBwSTExcTCwR/KygYCHs0eKgLLygfW19jZ1xfc3CgcFt/hHN3cFOfo6eroAe3tJwU7vL2+L8PIF7u0w+Pn6+/lV/lSruEBooGBgQYJxEio0yBChlgcQI0qcGPGORTsJMmrcyFFjEA7vL2+A7",
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