Forum Discussion

Benoit_Durand's avatar
Benoit_Durand
Icon for Nimbostratus rankNimbostratus
Jan 07, 2020

Need Help with an iRule to Change HTML Status-Line Text

Greetings and thank you for your time. I have a back end node that provides status code "200" when customers (clients) expect "200 OK" in their own monitors. I tried the snippet below but it drops all subsequent Headers provided by the back end node. Essentially, I simply need to replace "200" with "200 Ok" in the HTML status response provided to the client.

 

when HTTP_RESPONSE {

  if { [HTTP::status] contains "200"} {

    HTTP::respond 200 content [HTTP::payload]

  }

}

2 Replies

  • Hi Benoit Durand,

    Can you try this?

    when HTTP_REQUEST_SEND {
    	TCP::collect 15
    }
     
    when SERVER_DATA {
    	# log local0. "[TCP::payload 15]"
    	if { ([TCP::payload 15] contains "200") and not ([TCP::payload 15] contains "200 OK") } {
    		TCP::payload replace 9 3 "200 OK"
    	}
    	TCP::release
    }
    • Benoit_Durand's avatar
      Benoit_Durand
      Icon for Nimbostratus rankNimbostratus

      Thanks eaa, will try it tomorrow.

       

      Question though: Will this only apply to the initial HTML header or any subsequent TCP payload that contains "200" as part of of the first 15 bytes of a server data response?