Forum Discussion

Jason_G__141424's avatar
Jason_G__141424
Icon for Nimbostratus rankNimbostratus
Jan 05, 2015

Removing HTTP headers within an HTTP::respond

Quick question on how to remove items from the HTTP header while doing an HTTP:respond within an iRule. I currently have the following HTTP:respond.

 

HTTP::respond 200 content $static::blockpage Cache-Control "private" Content-Type "text/html; charset=utf-8"

 

The output of the HTTP:respond is as follows:

 

HTTP/1.0 200 OK Cache-Control: private Content-Type: text/html; charset=utf-8 Server: BigIP Connection: Keep-Alive Content-Length: 6952

 

I need to be able to remove the server, connection and content-length header information within the request. Any pointers on hos this may be accomplished would be appreciated.

 

2 Replies

  • what about something like this?

     configuration
    
    [root@ve11a:Active:In Sync] config  tmsh list ltm rule qux
    ltm rule qux {
        when RULE_INIT {
      set static::blockpage "hello world\r\n"
      set static::len [string length $static::blockpage]
    }
    when HTTP_REQUEST {
      TCP::respond "HTTP/1.0 200 OK\r\nCache-Control: private\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: ${static::len}\r\n\r\n$static::blockpage"
    }
    }
    
     test
    
    [root@ve11a:Active:In Sync] config  curl -i http://172.28.24.10
    HTTP/1.0 200 OK
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Content-Length: 13
    
    hello world