Forum Discussion

together_183451's avatar
together_183451
Icon for Nimbostratus rankNimbostratus
Mar 10, 2015

need help for some specific uri redirection from http to https

Hi my requirement is like some applications should NOT re-direct to https and some of them applications can re-direct to https For this i have created below Irule but it is not taking If i remove https redirection then it is working. please help me for the same.

 

when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "abc.com" } { if { ([string tolower [HTTP::uri]] starts_with "/Customer_Portal") or ([string tolower [HTTP::uri]] starts_with "/CustomerFeedback") or ([string tolower [HTTP::uri]] starts_with "/Dimension") or ([string tolower [HTTP::uri]] starts_with "/Pages") or ([string tolower [HTTP::uri]] starts_with "/Sales_Portal") or ([string tolower [HTTP::uri]] starts_with "/XMLApplication") or ([string tolower [HTTP::uri]] starts_with "/Encer_Integration") } then { pool test_pool } elseif{ (HTTP::redirect "https://[HTTP::host][HTTP::uri]" ) } else { pool UAT_pool } } }

 

6 Replies

  • since you use string lower, uri must be in lower case e.g. /customer_portal

    if { ([string tolower [HTTP::uri]] starts_with "/Customer_Portal")
    

    and i do not think this part is correct.

    } elseif{ (HTTP::redirect "https://[HTTP::host][HTTP::uri]" ) } else { 
       pool UAT_pool 
    } 
    
  • i know, that part is not correct can you help me how i will write the irule

    i do not know your requirement. anyway, this is just an example.

    [root@ve11c:Active:In Sync] config  tmsh list ltm rule qux
    ltm rule qux {
        when HTTP_REQUEST {
      if { [HTTP::host] equals "abc.com" } {
        switch -glob [HTTP::path] {
          "/Customer_Portal*" -
          "/CustomerFeedback*" -
          "/Dimension*" -
          "/Pages*" -
          "/Sales_Portal*" -
          "/XMLApplication*" -
          "/Encer_Integration*" {
             Do something
          }
          default {
             Do something
          }
        }
      } else {
         Do something
      }
    }
    }
    
  • i don't want to redirect towards pool. I have default pool but some uri do not redirect towards https

     

  • i don't want to redirect towards pool. I have default pool but some uri do not redirect towards https

     

    can you more specific please? so, i can add it into the irule.

     

    now, i do not even know what some uri is. :)