Forum Discussion

Raz_Cohen's avatar
Raz_Cohen
Icon for Nimbostratus rankNimbostratus
Aug 26, 2021

Using Multiple iFiles in an iRule

Hi, I am configuring a virtual server that uses an iRule to present an html file of a maintenance page.

The html is in the big ip as an iFile. The page is working properly with the following simple iRule:

when HTTP_REQUEST {
    HTTP::respond 200 content [ifile get Construction-html] "Content-Type" "text/html"
}

I am trying to use a different iFile as the icon at the tab of the web page. I saw in this kb https://support.f5.com/csp/article/K25815544 that I need to add this:

HTTP::respond 200 content [ifile get <icon_iFile>] "Content-Type" "image/x-icon" 

My question is how can I respond with both of those iFiles in a way that the html file will show the web page and the other file will show the icon.

Is it possible?

Thank you,

Raz.

  • Try this

    when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::uri]] {
     "*/favicon.ico" { HTTP::respond 200 content [ifile get <icon_iFile>] "Content-Type" "image/x-icon" }
        default      { HTTP::respond 200 content [ifile get Construction-html] "Content-Type" "text/html" }
    	  } 
       }

2 Replies

  • Try this

    when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::uri]] {
     "*/favicon.ico" { HTTP::respond 200 content [ifile get <icon_iFile>] "Content-Type" "image/x-icon" }
        default      { HTTP::respond 200 content [ifile get Construction-html] "Content-Type" "text/html" }
    	  } 
       }