For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Holck_4564's avatar
Holck_4564
Icon for Nimbostratus rankNimbostratus
Nov 16, 2007

iRule to change content in text/html

Hello,

 

 

Im looking for a sort of solution to rewrite contents in files matching text/html..

 

The files transferred via the loadbalancer contains data where I need to modify

 

the content.

 

 

If a file is transferred and matches "src=/folder/..." and "href=/folder/..." I want to make the /folder with an absolute url including /folder/.

 

 

From ...src="/folder/hello.jpg" to ...src="https://www.domain.com/folder/hello.jpg"

 

 

Is this a simple task?

 

 

 

// A

1 Reply

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi,

     

     

    If you want to rewrite a specific string like 'src="/' to 'src="https://www.domain.com/', in the HTTP data of every request and response, you could use a stream profile (Click here).

     

     

    If you want more control over when the replacement is performed, you can add a blank stream profile to the virtual server and then use an iRule to specify the find/replace strings and the context (request and/or response) the replacement is done in.

     

     

    The STREAM::expression wiki page (Click here) has a few examples.

     

     

    Aaron