Forum Discussion

shawn306_84070's avatar
shawn306_84070
Icon for Nimbostratus rankNimbostratus
Apr 21, 2010

HELP !!!! With I rule

I have been asked to created a vip that will load balance a pair of biztalk servers.

 

 

I created the VIP and everything looked great. It was load balancing very nicely and the http redirect irule I created was working fine.

 

 

 

when HTTP_REQUEST {

 

if { [HTTP::host] eq "bttst"} {

 

HTTP::redirect "]"

 

}

 

}

 

 

Here is where the problems began. When you typed it brought up a login prompt. If you went directly to the the server, i.e https://biztalk-01.abc.com it did what it was supposed which was bring up the ESB Management Console.

 

 

So from that point I created a simple irule that would redirect the traffic to just that one server.

 

 

when HTTP_REQUEST {

 

HTTP::header replace Host "biztalk-01.abc.com"

 

}

 

 

This irule worked fine. It redirected the request directly to that server and everything worked fine.

 

 

Now I have to add the the other server biztalk-02.abc.com to the irule.

 

 

I looked around, downloaded the irule editor. From what I gather it looks like I have to create a datagroup with both servers in the group and then create the irule using the datagroup as a reference.

 

 

I found a couple of posts that I thought might be of help to me I just don't totally understand them.

 

 

http://devcentral.f5.com/Wiki/defau..._name.html

 

 

https://devcentral.f5.com/Default.a...&aft=27386

 

 

If anyone out there can give me a hand on this it would be greatly appreciated.

 

 

Thanks

 

 

Shawn

 

 

 

 

7 Replies

  • Hi Shawn,

     

     

    Nice work in looking for existing examples for your scenario. The Codeshare example you linked to should work fine for your scenario. Just create the datagroup containing the IP and hosts and then define the iRule and add it to the virtual server.

     

     

    If you have any issues, check /var/log/ltm for the iRule debug logging output. When you're done testing, set the host_debug to 0 to disable the logging.

     

     

    Aaron
  • When you say codeshare are you talking about the irule you created ?

     

     

    I created a datagroup called biztalk_class list that has the ip's of both servers. (Type address)

     

     

    Is that the correct way to create the datagroup for this type of setup ?

     

     

     

     

  • Yeah, the example iRule is in the iRule Codeshare:

     

     

    http://devcentral.f5.com/Wiki/default.aspx/iRules.CodeShare

     

    rewrite_host_header_to_server_name

     

     

    The datagroup should be of type 'string' with each line containing one IP address, a space and then the hostname to rewrite to.

     

     

    Aaron
  • Thanks Aaron,

     

     

    Here is what i got in the logfile after I made the changes and did some testing

     

     

    Apr 21 15:25:10 local/tmm info tmm[12687]: Rule vs_bitztest_server_irule : 10.69.100.972473: Looked up , found: .

     

    Apr 21 15:25:17 local/tmm info tmm[12687]: Rule vs_bitztest_server_irule : 10.69.100.972473: New GET request to bttst.nc.us/esb.portal

     

    Apr 21 15:25:17 local/tmm info tmm[12687]: Rule vs_bitztest_server_irule : 10.69.100.972473: Looked up IP Address, found: biztst-02.nc.us.

     

    Apr 21 15:25:17 local/tmm info tmm[12687]: Rule vs_bitztest_server_irule : 10.69.100.972473: Replaced Host header with biztst-02.nc.us.

     

     

    So it would appear from there that the header was replaced.

     

     

    Still though when I type bttst/esb.portal the login prompt is for bttst.nc.us and not biztst-02.nc.us.

     

     

    Going to play around with this a little more but your input here would be great.

     

     

    Shawn
  • Hi Shawn,

     

     

    Is the issue that something on the page or the authentication prompt is listed incorrectly or that the client is sent the wrong content from the server? How does this correlate with the Host header value?

     

     

    Aaron
  • It looks like the authentication prompt is what is the problem.

     

     

    When I set up the irule to just go to one server it worked fine

     

     

    when HTTP_REQUEST {

     

    HTTP::header replace Host "biztst-02.nc.us"

     

    }

     

     

    I would then go to the browser type or http://bttst.nc.us/esb.portal and it would re-direct fine and the login prompt would come up showing that I was logging into biztst-02.nc.us and I could log in fine and get to the page I needed to.

     

     

    Now when I tried it with the new irule it looks like everything is okay but when hit those links that I gave you above it does the redirect but instead of the login prompt showing me that I am logging into biztst-02 it shows me logging into bttst.nc.us. I try logging in and I can't.

     

     

    I don't understand why though if the ltm is showing the header being replaced the way it should. Gonna dig a little deeper.

     

     

    Thanks again for your help on this.

     

     

    Shawn
  • Finally got it to work !!!!!

     

    The script you recommended Aaron worked great. I just had to make a change in the string using the ip address and the servername instead of the fully qualified domain name to eliminate the login prompts.

     

    Can't thank you enough.

     

    Shawn