Forum Discussion

InfoSec_38553's avatar
InfoSec_38553
Icon for Nimbostratus rankNimbostratus
Feb 12, 2012

Removing Server Header from F5 Response

Hi all,

 

 

I have irule block specific request. The F5 response include this header:

 

Server: BigIP

 

 

How I can remove this header from F5 response.

 

 

Note: This F5 response not server response.

 

 

 

I tried the following code, but it is not working.

 

I'm not sure I already using the right event for this.

 

 

 

when HTTP_RESPONSE {

 

TCP::collect

 

}

 

}

 

 

when HTTP_RESPONSE_DATA {

 

if { [regexp -indices "Server: BigIP" [TCP::payload] firstmatch] } {

 

set matchlen [expr [lindex $firstmatch 1] - [lindex $firstmatch 0] + 1]

 

set replacement [binary format c* {97 98 99 0 100 101 102}]

 

TCP::payload replace [lindex $firstmatch 0] $matchlen ""

 

TCP::release

 

}

 

}

 

 

 

Also I tried this event:

 

 

 

 

when SERVER_CONNECTED {

 

TCP::collect

 

}

 

 

when SERVER_DATA {

 

if { [regexp -indices "Server: BigIP" [TCP::payload] firstmatch] } {

 

set matchlen [expr [lindex $firstmatch 1] - [lindex $firstmatch 0] + 1]

 

set replacement [binary format c* {97 98 99 0 100 101 102}]

 

TCP::payload replace [lindex $firstmatch 0] $matchlen ""

 

TCP::release

 

}

 

}

 

 

 

  • I have irule block specific request. The F5 response include this header:

     

    Server: BigIPcan you post the irule which blocks specific request?
  • If you're using HTTP::respond to generate the response, you can use the noserver flag to prevent LTM from inserting the Server: BigIP header:

     

     

    http://devcentral.f5.com/wiki/iRules.http__respond.ashx

     

    Note: The noserver flag was added in 9.4.2. It suppresses the insertion of the 'Server: BigIP' header. The noserver flag must be included before the content (if any).

     

     

    Aaron