Forum Discussion

Thiyagu_163984's avatar
Thiyagu_163984
Icon for Nimbostratus rankNimbostratus
Oct 25, 2017

iRule to replace http response data

I'm troubleshooting application issues where for some reason web servers are dropping some of the content in the HTTP response. Application team is working on few option to resolve the issue.

 

I'm trying a lot how the issue can be resolved from the LB using iRULE.

 

Condition for which I need the iRULE: In in HTTP response if the line in the content is "Next line in readAODResponseStatusCode - 0" and it needs to be replaced with "Next line in readAODResponseStatusCode - 0000"

 

Here is the iRULE which I have planned to apply:

 

when HTTP_RESPONSE_DATA { set payload [HTTP::payload] set find "Next line in readAODResponseStatusCode - 0" set replace "readAODResponseStatusCode - 0000" }

 

Can you please help me on this issue?

 

Regards, Thiyagu

 

1 Reply

  • If you just want to replace content in the HTTP response, then I would use a Stream profile and a basic iRule.

    when HTTP_REQUEST {
      STREAM::disable
    }
    
    when HTTP_RESPONSE {
        set oldString "Next line in readAODResponseStatusCode - 0"
        set newString "Next line in readAODResponseStatusCode - 0000"
        STREAM::expression {@$oldString@$newString@}
        STREAM::enable
      }
    }