Forum Discussion
iRule to examine response HTML for image URLs
You can use an HTML profile + iRule to log all the src attributes which is fairly simple and less resource intensive compared to HTTP::collect but the src attribute obviously isn't a full path or URI if that's what you really need. In my example below the logged 'src' attribute is image/blacklogo.png while the full URL http://mywebsite.com/test/image/blacklogo.png. From here you could store the src attributes value in a table or a variable to be used later.
Using your approach you will likely want to use some regex to identify the img tag in the collected HTTP data then log or store whatever value you want for example "<img([\w\W]+?)/>"
A third alternative would be to just parse the URI looking for image file extensions then log the full URL.
if { [string tolower [HTTP::uri]] contains ".png" } {
log local0. "[HTTP::url]"
}
== References ==
K99872325: Modifying HTML tag attributes using an HTML profile
∟ Match Tag Name = img
∟ Match Attribute Name = (empty)
∟ Match Attribute Value = (empty)
HTML::tag attribute (iRules CloudDocs)
when HTML_TAG_MATCHED {
log local0. "[HTML::tag attribute value "src"]"
}
http://mywebsite.com/test/
Oct 19 08:40:33 bigip1 info tmm[18126]: Rule /Common/matchImgTagiRule <HTML_TAG_MATCHED>: image/blacklogo.png
Oct 19 08:40:33 bigip1 info tmm[18126]: Rule /Common/matchImgTagiRule <HTML_TAG_MATCHED>: image/22.png
Oct 19 08:40:33 bigip1 info tmm[18126]: Rule /Common/matchImgTagiRule <HTML_TAG_MATCHED>: image/iislogo.png
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