Forum Discussion

jamesthethird_4's avatar
jamesthethird_4
Icon for Nimbostratus rankNimbostratus
Dec 12, 2011

Adding dynamic content to a request

Hi Everybody,

 

 

I've recently got a task from my boss to build an advanced iRule to one of our F5, and i'm struggling to understand if this is even doable with iRules.

 

 

 

To make a long story short, this is the high level design:

 

 

 

The F5 is in-line with all traffic coming in and out our website. Now, we want to add a small code to some of the outgoing responses (according to their path in the URL), in a fixed location. Here comes the tricky part:

 

 

 

This added code piece is dynamic, and should be queried from a third party server located at one of our partners data center. The code changes from time to time (more or less on a daily basis), and whenever it changes the new piece of code should be embedded in the same location. Now, our server handles a lot of traffic (hundreds of HTTPS requests per second on peak), and I find it very ineffiencent to query the dynamic code for every response served by our website.

 

 

 

So - my plan is to query the third party server every few minutes (separately from the ongoing website traffic), store the new code in a variable and add the most up-to-date code to the response.

 

 

 

 

 

So, is this achievable by an iRule?

 

 

 

Will appreciate your assistance with this challenge...

 

 

 

 

 

Thanks in advance

 

 

 

James

 

  • are these useful?

     

     

    v11 iRules: Intro to Sideband Connections by Colin

     

    http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086484/v11-iRules-Intro-to-Sideband-Connections.aspx

     

     

    insert javascript to html pages using irules (Aaron's message)

     

    http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1179209/showtab/groupforums/Default.aspx
  • Sideband connection is cool! However the example shows the connection is opened upon an HTTP_REQUEST event.

     

    My goal is to create a sideband connection every 5 minutes regardless of normal traffic (i.e. not to create a sideband connection upon an incoming request. I'd like it to be created even if there are no requests. Like with a timer). Is this possible?

     

     

    The second link shows how to add a JS code on the fly, which is OK. The question was how to update the JS you are about to add.

     

     

    Thanks!
  • The second link shows how to add a JS code on the fly, which is OK. The question was how to update the JS you are about to add. previously i thought you might retrieve dynamic content upon request, store it in variable and then insert it on the fly.

     

     

    I'd like it to be created even if there are no requests. Like with a timer). Is this possible? not sure if we run script, save dynamic content to file and then insert it by using ifile is workable.

     

     

    iFile wiki

     

    http://devcentral.f5.com/wiki/iRules.iFile.ashx

     

     

    v11.1–External File Access from iRules via iFiles by Jason

     

    http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086514/v111ndashExternal-File-Access-from-iRules-via-iFiles.aspx

     

     

    just my 2 cents.
  • Storing the content in a file might be a good idea for replacing the variable. However, we would like to focus on issuing a sideband connection every 5 minutes and updating the file/variable, regardless of traffic in the main channel. Is there such a mechanism (like a timer) for issuing a sideband connection every predefined period of time?
  • Hi James,

     

     

    you could issue a special crafted request which will trigger the sideband request from a dedicated system.

     

    So can have URL/Parameter which is not part of the regular user traffic and controll the intervall by the calling system.

     

     

    BR

     

    JP