Forum Discussion

Yugandhar's avatar
Yugandhar
Icon for Nimbostratus rankNimbostratus
Feb 02, 2019

iRule to replace title of the html message

Hi,

 

Can we have the below iRule to replace the title header with a script in the HTML message.

 

when HTTP_REQUEST {

 

if {[HTTP::path] equals "https://abc.com/id/summary.html";} {

 

set token 1

 

}

 

else {

 

set token 0

 

}

 

Disable the stream filter for client requests.

STREAM::disable

 

HTTP::header remove "Accept-Encoding"

 

}

 

when HTTP_RESPONSE {

 

Disable the stream filter for all server responses

STREAM::disable

 

Inserts the necessary JavaScript for token

if {($token == 1) && ([HTTP::header "Content-Type"] starts_with "text/html")} {

 

STREAM::expression {

 

@@

 

;@}

 

Enable the stream filter for this response only

STREAM::enable

 

}

 

}

 

4 Replies

  • Is this iRule not working? What is your question exactly?

     

  • Hi Rico,

     

    I wanted to verify whether the code after the stream::expression is valid or not ?.

     

    Thanks,

     

    Yugandhar.

     

    • Yugandhar's avatar
      Yugandhar
      Icon for Nimbostratus rankNimbostratus

      Hi Samir,

       

      Want the title in the HTTP response be replaced with a custom message

       

      Thanks,

       

      Yugandhar.