Forum Discussion

F5explorer_1325's avatar
F5explorer_1325
Icon for Nimbostratus rankNimbostratus
Aug 28, 2013

Request for an irule for filtering HTTP_REQUEST to different pools

HTTP Request coming a single VIP IP on port 80 to be redirected to different internal pools

 

www.abc.com www.zyz.com www.acd.com

 

These ALL points to a single IP

 

Further www.abc.com to be directed to Pool abc and it should not respond to IP, but should only serve the web page when it have the proper URI in HTTP get request and also this VIP should listen for the other URI's as listed below and then redirect them to appropriate Pools www.zyz.com should go to Pool ZYZ www.acd.com should go to Pool ACD

 

and what about if we want to add an another conditional matching to this irule, and provision it again, would that result in some interruption in production..probably that needs to be seen

 

3 Replies

  • A very simple implementation of what you describe:

    when HTTP_REQUEST {
        switch [string tolower [HTTP::host]] {
            "www.abc.com" {
                pool ABC
            }
            "www.zyz.com" {
                pool ZYZ
            }
            "www.acd.com" {
                pool ACD
            }
        }
    }
    

    Further www.abc.com to be directed to Pool abc and it should not respond to IP, but should only serve the web page when it have the proper URI in HTTP get request

    Not sure what this means. As far as interruptions, there could be an ever-so-slight interruption in iRule processing as the iRule is being updates, but it would generally be VERY FAST.

  • Thanks Kevin

     

    "Further www.abc.com to be directed to Pool abc and it should not respond to IP, but should only serve the web page when it have the proper URI in HTTP get request"

     

    This is to have the VIP not respond to the HTTP_Request when someone types just an IP address, or whenever someone does that, point it to a default pool.

     

  • Ah, then just add a "default" clause to the end of the above switch statement:

    ...
    default {
       pool default_pool
        or reject
    }