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?
It probably isn’t such a good idea to serve up a 1MB image directly from the BIG-IP for a couple of reasons. The first being that TMM can only handle 4MB of data before it will intentionally restart itself. This is to prevent potential swapping to disk as well as interference with other tasks the BIG-IP may be performing. Secondly, for security reasons iRules do not have direct access to the filesystem. If you want to serve up a base64 encoded image from the BIG-IP, the data will either need to be included in the iRule itself or a datagroup. Both of which will reside inside of bigip.conf. If I were in your position, I would spin up an Apache server on a cheap piece of hardware and just use an iRule to send users there.
Thanks for the response. The iRule cannot access the file system directly, however the following article:
describes how to use a class to store the image on disk. The iRule simply calls the class. This iRule will not be used in production, it is only to clarify throughput up to the F5 to verify the perimeter firewall and IPS are capable of operating at the designed throughput.