Forum Discussion

Billy_56049's avatar
Billy_56049
Icon for Nimbostratus rankNimbostratus
Jul 13, 2011

Replace or Remove Server tag from HTTP header

Hi!

 

 

I'm trying to remove Server tag from HTTP Header. Actually, I'm using redirect for HTTP to HTTPS.

 

 

I applied the following irule:

 

 

when HTTP_REQUEST {

 

 

TCP::respond "HTTP/1.0 302 Found\r\nLocation: http://$site/site/index.seam\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"

 

TCP::close

 

}

 

 

Afterwards, I did this test:

 

 

 

nc -vv xxx.xxx.xxx.xxx 80

 

Warning: forward host lookup failed for xxx.xxx.xxx.xxx.static.impsat.net.br: Unknown host : Connection timed out

 

xxx.xxx.xxx.xxx.static.impsat.net.br [xxx.xxx.xxx.xxx] 80 (www) open

 

HEAD / HTTP/1.0

 

 

 

HTTP/1.0 302 Found

 

Location: http://my.site.com/index.htm

 

Server: BigIP

 

Connection: close

 

Content-Length: 0

 

 

 

HTTP/1.0 302 Found

 

Location: http://my.site.com/index.htm

 

Connection: close

 

Content-Length: 0

 

 

The problem is: I can't remove Server tag, I just add another.

 

 

Could you help me?

 

 

Many thanks

 

  • Hi Billy,

     

     

    If that was the exact TCP::respond command you used, it couldn't have had the Server: BigIP header from the iRule. Maybe you have another iRule you saw that with?

     

     

    Regardless, on 9.4.2 and higher, you can use HTTP::respond with the noserver flag to suppress the Server: BigIP header:

     

     

    from http://devcentral.f5.com/wiki/default.aspx/iRules/http__respond

     

    HTTP::respond 302 noserver Location "https://[HTTP::host][HTTP::uri]"

     

     

    Aaron
  • Hey Aaron... Thank you so much for your support.

     

     

    So... I'm using BigIP10.1.0... I tried to use HTTP::respond on "When HTTP_REQUEST" and I hadn't success.

     

     

    The message is: Many redirect were found...

     

     

    Do you have any idea my friend?

     

     

    Thank you so much
  • Hi Billy,

     

     

    Can you post anonymized copies of the iRules you have enabled on this virtual server? You can use [ code ] [/ code ] blocks to post them here (without the spaces).

     

     

    Aaron
  • AAron... The problem is solved! :-)

     

     

    I repleced all redirects for respond.

     

     

    Example:

     

     

    HTTP::redirect "http://$site/survey1/"

     

    for

     

    HTTP::respond 302 noserver Location "http://$site/survey1/"

     

     

    Thank you so much for make things more clear!

     

     

    Regards.