Forum Discussion

abachman_72712's avatar
abachman_72712
Icon for Nimbostratus rankNimbostratus
Jul 31, 2009

Traffic destined for certain port

New to working with iRules.

 

 

I need to write an iRule for Soap HTTP call. The HTTP traffic will need to go to a certain port listening on the server pool (IBM WebSphere JVM on port 9082), but traffic will need to go to primary server all the time unless that server is down. Created a VIP server on BigIP with service port 9082. Traffic will be generated outbound with a DNS name that points to this BigIP virtual server ip. Do they also need to add the port(9082)with the header as well? (e.g. dnsname:9082)

 

 

when HTTP_REQUEST {

 

if { [HTTP::header "Content-Type"] contains "SoapAction" } {

 

node 10.10.10.15 9082

 

} else {

 

pool mysoap_pool

 

}

 

}

 

 

Any suggestions would be helpful.

 

 

Thanks

 

TA

 

 

8 Replies

  • When the app sends the client a reference to the VIP, it should include the port of the VIP if it's not 80 for HTTP or 443 for HTTPS. It shouldn't matter for load balancing what is in the HTTP host header unless you specifically use an iRule to check the Host header value.

     

     

    I'm not sure how your statement "traffic will need to go to primary server all the time unless that server is down" meshes with the iRule you've posted. That iRule would send all traffic with SoapAction in the Content-Type to one specific pool member and all other requests to the soap pool. The type of load balancing logic you refer to can be achieved using priority groups. You can check the LTM config guide for your version for details.

     

     

    Also, the Content-Type header value will probably contain xml, like text/xml and there would be a header *named* SoapAction and it would have a value. Maybe you want to check for 'HTTP::header exists "SoapAction"?

     

     

    Aaron
  • Thanks.

     

     

    You think a profile and iRule may not be needed then? Just a VIP server and setup the priority?

     

     

    TA
  • Is there a way to map ports on bigIP. For example, have client traffic browse on port 80, and when the traffic gets to the bigIP the bigIP can map that traffic to a different port say 9080?

     

     

    Thanks,

     

     

    TA
  • If you want to use a set of X number of servers normally and only use a set of Y servers if the first are down, you can do this without an iRule using priority groups.

     

     

    If you enable port translation on the virtual server, LTM will use the port that the pool member is defined on irrespective of which port the client made the request to.

     

     

    Aaron
  • I have the virtual server set to HTTP 80 with Port translation enabled, and the pool members are configured for port 9082. The http request is getting a HTTP 404 error in return but the URL on port 9082 of the server is up and online.

     

     

    The developers just attempted sending the request as //dnsname(VIP)/website and that worked. Instead of adding the /website from the originating traffic, how can I append /website to the traffic when it gets to the bigIP?

     

     

    Thanks,

     

    TA
  • You should see the same behavior through LTM as you do direct to the host.

    If you do want to prepend a string to the URI, you can use an iRule like this:

      
      when HTTP_REQUEST {  
      
          Prepend /website if it's not there already  
         if {not ([HTTP::uri] starts_with /website)}{  
      
            HTTP::uri "/website[HTTP::uri]"  
         }  
      }  
      

    Aaron
  • Thanks Hoolio.

     

     

    This is how I applied the iRule you sent over:

     

     

    when HTTP_REQUEST {

     

    Prepend /website if it's not there already

     

    if {not ([HTTP::uri] starts_with "/ClaimCenter")}{

     

    HTTP::uri "/ClaimCenter[HTTP::uri]"

     

    }

     

    }

     

     

    When I go to apply to VIP server, I get the following error:

     

     

    01070394:3: HTTP_REQUEST event in rule (XSoap_iRule) requires an associated HTTP or FASTHTTP profile on the virtual server (XSOAP).

     

     

    Do I just need to assign default values for these profiles (HTTP, FASTHTTP)?

     

     

    TA
  • In order to inspect or modify the HTTP content, you need to add a profile which tells LTM to parse the connection as HTTP. For greatest functionality, you can use an HTTP profile versus a Fast HTTP profile. You can start with the default HTTP profile. It should work as is. If you find you need to customze any of the settings, you can create a copy of the HTTP profile and modify that one.

     

     

    Aaron