Forum Discussion

JP_45076's avatar
JP_45076
Icon for Nimbostratus rankNimbostratus
Dec 26, 2014

How to set up iRules to create a generic site that will distribute to multiple servers/pools

We wouold like to set up a generic site using LTM that will distribute out to multiple servers/pools.

 

I currently have it working by storing pool info in a Cookie and the checking the Cookie everytime through the iRule. It works well, except if the client tries to use a second window or tab to go to a second site through the iRule. I only have one Cookie, so it can only track one session.

 

I've thought of creating multiple cookies, like poolcookie1, poolcookie2, etc., but I don't know how I would tie the proper cookie to the proper window. Does anybody have any ideas on how I might do this?

 

As an example, we want ltm.xxx.com/accounting to go to a pool of accounting servers, ltm.xxx.com/email to go to a pool of Mail servers, and so on. We do have an irule that figures out whi8ch pool to go to, changes the URI to the appropriate URI, and also sets and reads a cookie to keep track of what pools to use.

 

3 Replies

  • The best way to do what you're looking for is by using the APM module, but that would need to be licensed for use.

     

    The other option is one we've used a little bit, which it to do custom rewriting to the response. Since you're using URI based routing instead of HOSTNAME routing, you'll need to rewrite the response to ensure the prefix exists on all urls to that same site (e.g. for accounting, every link URI should start with "/accounting/xxx"). If your backend server already has the site set up to use /prefix/xxx, then the rewriting would be minimal if any at all.

     

    Another option as part of this would be to use a little fuzzy logic with the Referer header. You could check to see if the uri part is prefixed by one of your routes and redirect the user to a uri with that prefix. The problem with this method is that it's not foolproof, so it may take a bit of work to accomplish. (Took me a while to build out for our environment). I can probably share some logic if you're interested.

     

    If you can use different hosts (e.g. acct.xxx.com or email.xxx.com), even if they point to the same IP address, you could use the host header to then route the traffic to the desired pool (or other virtual)

     

  • giltjr's avatar
    giltjr
    Icon for Nimbostratus rankNimbostratus

    Do the applications create/use any type of session id cookie that you could use?

     

  • sorry i might be lost but why persistence cookie insert mode does not work.