Forum Discussion

Gill_32697's avatar
Gill_32697
Icon for Nimbostratus rankNimbostratus
Sep 19, 2013

redirect by pool help

url https://b-unitynet.mysite.com/Unity/Akcelerant.asmx url https://b-unitynet.mysite.com/weblet.asmx

 

I need to redirect to a pool otherwise defaul pool. below is what I have but does not seem to be redirecting..can you see any error in my irule.

 

when HTTP_REQUEST { if { ([string tolower [HTTP::host]]) contains "b-unitynet.mysite.com" } { switch -glob -- [string tolower [HTTP::uri]] { "akcelerant.asmx" { pool B-WebServices } "weblet.asmx" { pool B-WebServices } default { pool B-Unitynet} }

 

} }

 

4 Replies

  • Richard__Harlan's avatar
    Richard__Harlan
    Historic F5 Account

    This is most likely happening because the first request is being LB to the default pool. To fix this if can turn on oneconnect. This will tell the LTM to LB each HTTP request from the client and allow the iRule to route the request to the correct pool. You can also perform a LB::detach and then have the pool send the request to the correct pool.

     

  • A URI always starts with "/", so

    "/akcelerant.asmx"
    

    would be more appropriate. And since you're using a glob, the following would also work:

    "*akcelerant.asmx*"
    
  • I turned on onconnect and added LB::detach but still not redirecting me, im getting sent to the default pool and getting default page. My browser url is http://b-unitynet.mysite.com/unity/weblet.asmx ! ! when HTTP_REQUEST { if { ([string tolower [HTTP::host]]) contains "b-unitynet.mysite.com" } { LB::detach switch -glob -- [string tolower [HTTP::uri]] { "/akcelerant.asmx" { pool B-WebServices } "/weblet.asmx" { pool B-WebServices } "/unitysailws.asmx" { pool B-WebServices } }

     

    } }

     

  • Please add a log statement in the context of HTTP_REQUEST as follows:

    log local0. "URI: [HTTP::uri] Path: [HTTP::path] Query: [HTTP::query]"

    Monitor the log file:

    tail -f /var/log/ltm

    Perhaps you will notice a trailing query in your incoming requests.

    In this case the switch decission could be made based on [HTTP::path] or to follow Kevins advice by just adding a trailing '*' to each jump mark.