03-May-2021 02:55
Hello,
I am developing an iRule, and I am stuck on a piece of code, where I should respond with a specific CSS iFile, which will substitute the backend resource.
Within the CSS file is referenced a JPG file, which itself references a JPG contained on an external website.
The piece of iRule code is the following:
if {[URI::basename [HTTP::uri]] ends_with ".css"} {
HTTP::respond 200 content [ifile get <ifile_name>.css]
}
I looked at the documentation, but I had no luck.
I am wondering if anybody knows, if it's possible to reference an iFile within the CSS code, in order to fetch an F5 internal resource, instead of relying to an external website which might or might not contain the JPG file.
Thanks a lot in advance
03-May-2021
06:55
- last edited on
21-Nov-2022
16:18
by
JimmyPackets
I suspect I'm missing something (...and I don't know a lot about CSS, so it's quite likely... ;), but would the file that the CSS requires be requested by the agent/browser? If so, could you put in another "if" statement in your iRule? (or better still, an "elseif" statement) You can then include the reference to this file ("<ifile_jpg>.jpg") in your css file.
Taking your piece of code, something along the lines of this:
if {[URI::basename [HTTP::uri]] ends_with "file-from-css.jpg"} {
HTTP::respond 200 content [ifile get <ifile_jpg>.jpg]
}
Hope this helps.
03-May-2021
07:21
- last edited on
24-Mar-2022
01:12
by
li-migration
This is a duplicate thread from Op. The other thread is solution provided.