Forum Discussion

Reddy1's avatar
Reddy1
Icon for Altostratus rankAltostratus
Mar 04, 2019

URI Redirects with Data-groups

I have a simple requirement ,

 

  1. There are about 8 incoming URI's which has to be modified and send to the different pool.
  2. I have the Data-group created with the string (old uri) and value (new uri).
  3. The irule first assigns the variable old_uri with the incoming uri.
  4. The first IF condition checks if the old_uri equals to the string in the Data-Group.
  5. If the incoming URI matches to the Data-group , the variable new_uri will hold the string value. if {[class match $old_uri eq DATAGROUP]} { set new_uri [class match -value $old_uri eq DATAGROUP] HTTP::uri "$new_uri" pool $Test_pool } For some reason its not working !!!!!
  • Can the below irule work?

     

    if {[class search -name DATAGROUP contains [string tolower [HTTP::path]]]} { set new_path "[class match -value [string tolower [HTTP::path]] equals DATAGROUP]" HTTP::path "$new_path" log local0. " The new HTTP Path is [HTTP::path]" pool $Test_pool return }

     

  • Try this:

    when HTTP_REQUEST {
    
        if { [class match [string tolower [HTTP::path]] contains DATAGROUP] } {
            set NEW_PATH [class match -value [string tolower [HTTP::path]] equals DATAGROUP]
            HTTP::path $NEW_PATH
            log local0. "The new HTTP Path is [HTTP::path]"
            pool $Test_pool
            return
        }
    }