For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

kingmuir_152188's avatar
kingmuir_152188
Icon for Nimbostratus rankNimbostratus
Apr 28, 2014

irule forwarding to gtm address based on port

Is this possible...

Add the following irule to the gtm wide ip address..

when HTTP_REQUEST {

if { [TCP::local_port] equals "9074" } {                 

HTTP::redirect “test.com; } }

Then on the test gtm address pool have the members service port as *.

5 Replies

  • Okay, so if a user makes an HTTP request to an LTM VIP with a destination port of 9074, you want to redirect the user to test.com. Assuming the client browser doesn't already have cached resolution for test.com, the browser will perform a DNS query to GTM for test.com. Is that correct?

     

  • A wide IP is a point of DNS resolution and has nothing to do with ports. If you simply want to redirect to another URL, then you can do that in the LTM iRule and simply have GTM resolve the IP address of that URL.

     

  • So i can't write an irule that checks the port coming in and if its 9074 then its sends it to a different url which happens to be a gtm address. Currently the vip etc only services port 80 traffic

    Sure you can. The iRule you had in the first post would do that.

    when HTTP_REQUEST {
        if { [TCP::local_port] equals "9074" } {
            HTTP::redirect "http://test.com"
        }
    }
    

    If the request is for the 9074 local port, redirect the client to http://test.com. GTM would resolve http://test.com to a different IP address.

  • Well, yes, if the VIP is only configured for port 80, it will ignore any other port traffic. If you need to capture port 9074 requests, then perhaps you need to configure the VIP with a wildcard port and use an iRule to restrict it:

    when CLIENT ACCEPTED {
        switch [TCP::local_port] {
            "80" -
            "9074" { return }
            default { drop }
        }
    }
    when HTTP_REQUEST {
        if { [TCP::local_port] equals "9074" } {
            HTTP::redirect "http:://test.com"
        }
    }