Forum Discussion

Mark_Cloutier's avatar
Mark_Cloutier
Icon for Nimbostratus rankNimbostratus
Aug 16, 2013

Rewriting URI for load balancing domino servers

I load balance two pools of domino servers, one for users in Mail1 and one for users in Mail2. First request to the virtual server (mail.domain.com for exmaple) can go to any of the domino servers for authentication, and after authentication, domino server redirects (after we modified the redirect in the domino server) user to mail.domain.com/Mailx/mail/username.nsf?OpenDatabase. An irule looks for /Mail1 or /Mail2 in the URI in order to send to the appropriate server. However once the pool decision is made, I need to remove the /Mail1 or /Mail2 before sending to the domino server. Is there a slick way to do that? The examples I have seen append to HTTP::URI to create a new URI, I want to subtract.....

 

6 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Mark,

     

    Try the "string range" command in an irule.

     

    Something like "HTTP::uri [string range [HTTP::uri] x end]"

     

    Here's an excellent iRules 101 write up of strings for more details:

     

    https://devcentral.f5.com/articles/-the101-irules-101-string-handling-and-manipulation

     

    Should be enough "string range" examples on DC to get you what you want.

     

    Hope this helps, N

     

  • Hi Mark,

     

    I agree that Nathan's suggestion of using string range will work, but will require you to count the characters that you want to remove.

     

    If you are looking for something easier I would suggest "string map". Something like this:

     

    "HTTP::uri [string map {"/mail1" "" "/mail2" ""} [HTTP::uri]]"

     

    You've got lots of options :-)

     

    • nathe's avatar
      nathe
      Icon for Cirrocumulus rankCirrocumulus
      Thanks Michael - the daft thing is I use string map in one of my irules at work!!! More haste, less speed in responding I think.
  • Hi Mark,

     

    I agree that Nathan's suggestion of using string range will work, but will require you to count the characters that you want to remove.

     

    If you are looking for something easier I would suggest "string map". Something like this:

     

    "HTTP::uri [string map {"/mail1" "" "/mail2" ""} [HTTP::uri]]"

     

    You've got lots of options :-)

     

    • nathe's avatar
      nathe
      Icon for Cirrocumulus rankCirrocumulus
      Thanks Michael - the daft thing is I use string map in one of my irules at work!!! More haste, less speed in responding I think.