Forum Discussion

Ray_Ebersole_13's avatar
Ray_Ebersole_13
Icon for Nimbostratus rankNimbostratus
Jan 19, 2014

Redirect HTTP to Pool

Hi,

 

I have an iRule that is currently working to redirect an http to a server hosting a login form. We have now created a landing page on two nodes of a pool that I have created. I am not having any luck in getting the iRule to redirect to the Pool. Here is the current iRule and the new one that is not working. Any thoughts would be appreciated. The "url" after the equals are all the iterations and aliases of the address.

 

when HTTP_REQUEST { set o365_hostname [string tolower [HTTP::host]] if {$o365_hostname equals "url"|| $o365_hostname equals "url"|| $o365_hostname equals "url"|| $o365_hostname equals "url"|| $o365_hostname equals "url"|| $o365_hostname equals "url"}{ log.local0 "Hostname was redirected. Original name: $o365_hostname" HTTP::redirect http://myloginpage/[HTTP::uri] } }

 

The new one is:

 

when HTTP_REQUEST { set o365_hostname [string tolower [HTTP::host]] if {$o365_hostname equals "url"|| $o365_hostname equals "url"|| $o365_hostname equals "url"|| $o365_hostname equals "url"}{ pool Office365_Landing_Page } }

 

Thanks Ray

 

3 Replies

  • Hi Ray,

    First you need to ensure that what the client is requesting exists on the servers in that pool. The client won't receive any notification that anything different is going on in the background like it would using HTTP::redirect. If you set that pool to be the default pool on some VIP, does it behave as expected? Think of that as trying to eliminate the iRule as the source of your problem. In addition, you should make sure your VIP has a default pool defined.

    You should look into using a case/switch statement as it can really make things quite a bit easier to deal with.

    An example would look like:

     when HTTP_REQUEST {
       switch -glob [string tolower [HTTP::host]] {  I add glob to make matching a bit more loose, if you want exact matching then you can omit it.
         "url1" -  use the dash to indicate multiple arguments
         "url2" -
         "url3 {
           pool YOURPOOL
           }
         "other url" {
           pool OTHERPOOL
         }
         default {
          define a default action, ie: a fallback pool
         }
     }
    

    See the iRules 101 page for Switches at iRules 101 part 4: Switch

  • Hi Josh,

     

    Your response actually pointed me in the right direction. I created the landing page myself on the IIS VM's, created the nodes, added them to a pool I created and then added that pool to the Virtual server that has the external IP for the host name URL. Because I created the Virtual server a while ago as just a redirect with the o365 IP and url we have to another url that was already had a different external IP.

     

    I had forgot that and had not had to edit the advanced setting of the virtual server. Reading your answer with the questions pointed me at those advanced settings where I realized that I had not turned on Auto Map or optimization for the client or server side. I didn't need them with the redirect in the beginning because we were redirecting to form on a server just to pass authentication to AD for Office 365.

     

    With your prodding I have it working and can relax for the rest of the weekend.

     

    Thanks....Ray