Forum Discussion

siddhesh_137522's avatar
siddhesh_137522
Icon for Nimbostratus rankNimbostratus
Feb 14, 2014

How to rewrite HTTP payload using Irule

Hello Team,

 

I have simple requirement that i need to rewrite HTTP payload whenever a request if genrated for opening a document.

 

For ex:- The below link and chracter which is made bold shoudl be replaced when request land on server https://abc.com/xyz/123xcv/1401300147/InfoView/listing/main.do?service=/common/appService.do&appKind=InfoView&isNewWindow=true&newUrl=https%3A%2F%2Fabc.com%2Fxyz%2F123xcv%

 

I need to replace the trailing https%3A%2F%2Fabc.com% with http://xyz.com:8080/...

 

I tried above with stream profile but not able to get any sucess..

 

Helpful if someone can put light on the above rewriting..

 

Regards Siddhesh

 

  • Is this URL in the browser address bar, or actually in the HTTP payload? If the latter, request or response?

     

  • Well, just a hunch here, but guessing you could accomplish this with a stream iRule. Apply a blank stream profile to the VIP and this iRule:

     

    when HTTP_REQUEST {    
         disable server side compression         
        HTTP::header remove Accept-Encoding        
    
         disable stream for requests         
        STREAM::disable
    }    
    when HTTP_RESPONSE {    
         only do this for text-based responses        
        if { [HTTP::header Content-Type] contains "text" } {        
             establish the stream expression             
            STREAM::expression {@https%3A%2F%2Fabc.com@http://xyz.com:8080@}
    
             enable stream processing            
            STREAM::enable
        }
    }    
    

     

    You may actually need to do this:

     

    {@https%3A%2F%2Fabc.com@http%3A%2F%2Fxyz.com%3A8080@}