Forum Discussion

Andrew_Watson_1's avatar
Andrew_Watson_1
Icon for Nimbostratus rankNimbostratus
Feb 24, 2014

Pool selection with uri rewrite for Ellucian Banner

Hello!

 

I am fairly new to the f5 and LBs in general. We have several back end servers that are currently serving multiple websites on different TCP ports. We are looking to load balance these servers with our F5 (11.2.1), ideally under a single virtual server running on 443. I currently have each application/port setup as separate pools. Can someone share with me an example irule that would help me with the following situation?

 

https://application.foo.com/forms/... => http://BE1.foo.com:8888/forms/.....

 

https://application.foo.com/reports... => http://BE1.foo.com:9002/reports/....

 

https://application.foo.com/SSB/... => http://BE1.foo.com:9010/test/...

 

https://application.foo.com/bannerOH... => http://BE1.foo.com:9003/bannerOH/...

 

and

 

https://application.foo.com/forms/... => http://BE2.foo.com:8888/forms/.....

 

https://application.foo.com/reports... => http://BE2.foo.com:9002/reports/....

 

https://application.foo.com/SSB/... => http://BE2.foo.com:9010/test/...

 

https://application.foo.com/bannerOH... => http://BE2.foo.com:9003/bannerOH/...

 

It seems pretty straight forward to write an irule to select the correct pool based on the uri. However, I am having problems figuring out the best way to deal with the one uri that needs to be rewritten (/SSB => /test).

 

Perhaps I am going about this the wrong way, but any advice would be greatly appreciated.

 

Thanks so much!

 

Andrew Watson

 

  • Sorry forgot the sample datagroup;

    ltm data-group internal dg_path_list { 
    records { 
        "/forms" { 
             data "pool pl_foo.com_8888" 
         } 
        "/reports" { 
            data "pool pl_foo.com_9002" 
        } 
        "/SSB" { 
            data "rewrite /test" 
        } 
    } 
    type string 
    }
    
  • Add a datagroup;-

    and an iRule (untested but you should get the idea);

    when HTTP_REQUEST {
         Match request path against datagroup and extract both key and value
        set ele [class match -element [string tolower [HTTP::path]] starts_with $dg_path_list]
         Switch on element value
        switch -glob [lindex $ele 1] {
            "pool *" {
                if {[catch {pool [getfield [lindex $ele 1] " " 2]}]} {
                     Error in datagroup - pool does not exist
                    HTTP::respond 500 noserver
                }
                return
            }
            "rewrite *" {
                 Check rewrite path valid
                if {[getfield [lindex $ele 1] " " 2] starts_with "/"} {
                     Substitute match path (key) with rewrite value from element value
                    HTTP::uri "[getfield [lindex $ele 1] " " 2][substr [HTTP::uri] [string length [lindex $ele 0]]]"
                } else {
                     Error in datagroup - path not valid
                    HTTP::respond 500 noserver
                }
            }
            default {
                 Do nothing
            }
        }
    }
    
  • Sorry forgot the sample datagroup;

    ltm data-group internal dg_path_list { 
    records { 
        "/forms" { 
             data "pool pl_foo.com_8888" 
         } 
        "/reports" { 
            data "pool pl_foo.com_9002" 
        } 
        "/SSB" { 
            data "rewrite /test" 
        } 
    } 
    type string 
    }
    
  • Start with something like this:

    when HTTP_REQUEST {
        switch -glob -- [string tolower [HTTP::uri]] {
            "/forms/*" {
                pool pool_8888
            }
            "/reports*" {
                pool pool_9002
            }
            "/ssb/*" {
                pool pool_9010
                HTTP::uri [string map -nocase {"/ssb/" "/test/"} [HTTP::uri]]
            }
            "/banneroh*" {
                pool pool_9003
            }
        }
    }
    

    where each of the pools above (ex. pool_9003) would contain and load balance both servers (BE1 and BE2). The [string map ] function for the "/ssb/*" URI simply replaces /ssb/ in the URI with /test/. This is a transparent rewrite, so the client won't see it.

  • Kevins (iRule) is prettier than mine, and his "string map" is way more elegant than my mash-up!!

     

    Datagroups work for us because of the operational processes in my company. An iRule update has to be executed 1-6am, while a datagroup update can be executed during business hours.

     

  • Thanks for the quick replies. These are great examples and very helpful. I will test them out in the morning and let you know how it goes.

     

  • Just a question to Andrew. I'm trying to put Ellucian Internet Native Banner behind the F5 with out much success. Do happen to have some pointer as to how you have done this?