Forum Discussion

jba3126's avatar
jba3126
Icon for Cirrus rankCirrus
Aug 08, 2011

Select Pool Based on URI with Host Rewrite

Hi All, In short we are going from SharePoint 2007 to 2010. To ease the pain of migrating sites I suggested we use the F5 LTMs to redirect based on the URI. I attempted this with a http class until I discovered that SharePoint checks the host name in the HTTP header. I've been told we might have as many as 30 URIs/Paths to redirect to the old 2007 instance and will need to remove them from the list so to speak as they migrate to 2010. I've done my very best to try to piece together a script that will do the trick and unfortunately I'm falling short :(

 

 

Summary:

 

http://www.abc.com

 

/uri1

 

/uri2

 

/uri3

 

/uri4

 

etc. needs to go to sharepoint2007pool and change host from www.abc.com to www.xyz.com. Everything else needs to go to sharepoint2010pool with no host change.

 

 

Here is my attempt to accomplish:

 

when HTTP_REQUEST {

 

switch -glob [HTTP::path]

 

if { [HTTP::path]] "/sites/dts*" } {

 

Rewrite host header value and select pool

 

HTTP::header replace Host www.xyz.com

 

pool sharepoing2007pool

 

}

 

else {

 

pool sharepoint2010pool

 

}

 

}

 

 

***For ease of adding and removing multiple sites, I'm very interested in how I might use the datagroups. That would make it much easier for me to add and remove sites as needed.***

 

7 Replies

  • Hi Jeff,

     

     

    So are all of the sites on www.abc.com but with different URIs? Which LTM version are you running?

     

     

    Aaron
  • All of the request will come in as www.abc.com but with different URI; however when the request is passed to the web server it will need to be different based on which sharepoint instance it goes to. Apparently sharepoint looks at the host header. The sharepoint team is going to provide us with a list of URI that will need to go to the old sharepoint. Everything else can just go straight to the new sharepoint pool. In reading other posts I'm wondering if I should try to create a datagroup/class. Anything that matches the class would get sent to the old pool and the host would be changed and everything else would be sent to the new pool and the host header left in tact.

     

     

    Example -

     

    New Web Server Pool

     

    Comes in www.abc.com

     

    /uri1 - New Site

     

    /uri2 - New Site

     

     

    When the request is sent to the new web server pool the host would stay in tact - so www.abc.com/uri1 or www.abc.com/uri2

     

     

    Old Web Server Pool

     

    Comes in www.abc.com

     

    /uri3 - Old Site

     

    /uri4 - Old Site

     

     

    When the request is sent to the old web server pool the host would need to change - so www.xyz.com/uri3 or www.xyz.com/uri4

     

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    It sounds like the class approach would be solid. If you have a set list of URIs that need to be redirected, that would be the easiest way to do it, and also the most manageable long term.

     

     

    Now, are you looking to do a full client redirect or to re-write the header in line both directions?

     

     

    Colin

     

  • when HTTP_REQUEST {  
      if { [string tolower [HTTP::path]] starts_with "/sites/dts" } { 
         Rewrite host header value and select pool  
        HTTP::header replace Host www.xyz.com     
        pool sharepoing2007pool 
      } 
      else { 
        pool sharepoint2010pool 
      } 
    } 

    You pretty much had it... just left a switch statement in that you didn't need anymore 🙂 For robustness I added a lowercase conversion.

    Jarvil
  • That is a great question. I would like this to be as transparent as possible to the end user. In other words I want the users typing www.abc.com from here on out. If the site did a full redirect, I'd be a afraid I'd start having users bookmark the old www.xyz.com site.
  • Thank you for the correction. I will test this out in my lab. Since I will have a list of URIs (30 or so in all) what will be the best way for me add the next URI to this list? Example the next site for testing is /sites/opunix

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    To add more items to the data group you can edit it via the GUI, via the CLI, or via iControl, it really just depends on your preference. In most cases people use the GUI or CLI to manage small-ish data groups.

     

     

    Colin