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

draco's avatar
draco
Icon for Nimbostratus rankNimbostratus
Mar 23, 2017

redirect to a pool for multiple uri

I have multiple sites and each site uses multiple uri's , so i need to redirect to a particular pool based on the uri's .Like if its /index.html or /benefits or /analytics -> it should direct the traffic to service on port 9797 .

 

will the below work ?

 

when HTTP_REQUEST {

 

log local0. "BI request received" if { [HTTP::path] equals "/index.html" || [HTTP::path] equals "/benefits" || [HTTP::path] equals "analytics" || [HTTP::path] equals "/bicomposer"} { log local0. "BI request for BI service received. Selecting end server" pool OHS_BI_9797 log local0. "BI end server selected: [IP::server_addr]" }

 

There are other pools also to be redirect to based on to other uri's which i could mention as an else statement ?

 

18 Replies

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    Yes, you can do that provided the logic is correct

    when HTTP_REQUEST {
        log local0. "BI request received" 
        if { [HTTP::path] equals "/index.html" || [HTTP::path] equals "/benefits" || [HTTP::path] equals "analytics" || [HTTP::path] equals "/bicomposer" } {
            log local0. "BI request for BI service received. Selecting end server" 
            pool OHS_BI_9797 
            log local0. "BI end server selected: [IP::server_addr]"
        } elseif { [HTTP::path] equals "xxx" } {
            pool XXXXX
        }
    }
    
    • draco's avatar
      draco
      Icon for Nimbostratus rankNimbostratus

      Hey Kunjan

       

      Can you see any error in this code ?

       

      when HTTP_REQUEST {
      
      switch -glob [HTTP::uri] {
      
      "/index.html" -
      "/benefits/*" -
      "/analytics/*" -
      "/xmlpserver/*" -
      "/ui" -
      "/mapviewer/*" -
      "/bicomposer" -
      "/bisearch/*" -
      "/console/*" -
      "/biacm/*" -
      "/bimiddleware/*" -
       {
      
       / URI b URI
      
      pool URI_b_pool
      }
      default {
      
       non-/site a URI
      
      pool URI_default_pool
      }
      }
      }
    • Jinshu's avatar
      Jinshu
      Icon for Cirrus rankCirrus

      It would be easy to read if you can format (select the irule and Ctrl+K) this irule, Divya.

       

      -Jinshu

       

    • draco's avatar
      draco
      Icon for Nimbostratus rankNimbostratus
       when HTTP_REQUEST {
      
      switch -glob [HTTP::uri] {
      
      
      "/index.html" -
      "/benefits/*" -
      "/analytics/*" -
      "/xmlpserver/*" -
      "/ui*" -
      "/mapviewer/*" -
      "/bicomposer*" -
      "/bisearch/*" -
      "/console/*" -
      "/biacm/*" -
      "/bimiddleware/*" -
       {
       / URI b URI
      pool URI_b_pool
      }
      default {
       non-/site a URI
      pool URI_default_pool
      }
      }
      }
      
      sorry, didnt see that...i get error at 'default'
      
  • Yes, you can do that provided the logic is correct

    when HTTP_REQUEST {
        log local0. "BI request received" 
        if { [HTTP::path] equals "/index.html" || [HTTP::path] equals "/benefits" || [HTTP::path] equals "analytics" || [HTTP::path] equals "/bicomposer" } {
            log local0. "BI request for BI service received. Selecting end server" 
            pool OHS_BI_9797 
            log local0. "BI end server selected: [IP::server_addr]"
        } elseif { [HTTP::path] equals "xxx" } {
            pool XXXXX
        }
    }
    
    • draco's avatar
      draco
      Icon for Nimbostratus rankNimbostratus

      Hey Kunjan

       

      Can you see any error in this code ?

       

      when HTTP_REQUEST {
      
      switch -glob [HTTP::uri] {
      
      "/index.html" -
      "/benefits/*" -
      "/analytics/*" -
      "/xmlpserver/*" -
      "/ui" -
      "/mapviewer/*" -
      "/bicomposer" -
      "/bisearch/*" -
      "/console/*" -
      "/biacm/*" -
      "/bimiddleware/*" -
       {
      
       / URI b URI
      
      pool URI_b_pool
      }
      default {
      
       non-/site a URI
      
      pool URI_default_pool
      }
      }
      }
    • Jinshu's avatar
      Jinshu
      Icon for Cirrus rankCirrus

      It would be easy to read if you can format (select the irule and Ctrl+K) this irule, Divya.

       

      -Jinshu

       

    • draco's avatar
      draco
      Icon for Nimbostratus rankNimbostratus
       when HTTP_REQUEST {
      
      switch -glob [HTTP::uri] {
      
      
      "/index.html" -
      "/benefits/*" -
      "/analytics/*" -
      "/xmlpserver/*" -
      "/ui*" -
      "/mapviewer/*" -
      "/bicomposer*" -
      "/bisearch/*" -
      "/console/*" -
      "/biacm/*" -
      "/bimiddleware/*" -
       {
       / URI b URI
      pool URI_b_pool
      }
      default {
       non-/site a URI
      pool URI_default_pool
      }
      }
      }
      
      sorry, didnt see that...i get error at 'default'