Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

Using Multiple iFiles in an iRule

Raz_Cohen
Nimbostratus
Nimbostratus

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.

1 ACCEPTED SOLUTION

SanjayP
MVP
MVP

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" }
	  } 
   }

View solution in original post

2 REPLIES 2

SanjayP
MVP
MVP

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" }
	  } 
   }

Raz_Cohen
Nimbostratus
Nimbostratus

It works! Thank you very much.