Forum Discussion

Gary_Bristol_19's avatar
Gary_Bristol_19
Icon for Nimbostratus rankNimbostratus
Nov 06, 2015

Search External Data Group with default pool with no match

conditions to be met.
1. search External Data Group file for match on pool or redirect. works
2. send the base url to the CMS systems done
3. on external data group miss or something that is more than just the base URL, like www.ou.edu/george
    it needs to be sent to specific pool  ??

   when RULE_INIT {
  Turn Debug on or off (0=off 1=on)
  Turn debug off in prod
  set static::redir_debug 1
}
when HTTP_REQUEST {
  Use following to match against datagroup
   Use following to match against datagroup
  set match_string [string tolower [HTTP::host]]
  append match_string [string tolower [HTTP::path]]
  if {$static::redir_debug}{log local0. "Match String: $match_string"}


Lookup the redirect or pool based upon match_string value
   set goto [class match -value [string tolower [HTTP::host][HTTP::path]] starts_with www_ou_edu_redir_class]
 if { $goto equals ""}{
       if {$static::redir_debug}{log local0. "Match String Not Found"}
    pool ouwww_bostitch
    return
  }
  if { [getfield $goto "," 1] equals "pool" } {
     if {$static::redir_debug}{log local0. "Pool declaration detected. Going to: [getfield $goto "," 2]"}
        pool [getfield $goto "," 2]
  } else {
     if {$static::redir_debug}{log local0. "Redirect declaration detected. Redirecting to: [getfield $goto "," 2]"}
       HTTP::redirect http://[getfield $goto "," 2]
  }
}

Some sample Data

admissions.ou.edu := "redir,www.ou.edu/admissions.html",
action.ou.edu := "pool,ouwww_bostitch",
academictech.ou.edu := "redir,ouacademictech.com",
aasa.ou.edu := "redir",www.ou.edu/studentlife/diverse_communities/asian_american_studentlife/groups/aasa.html",
www.ou.edu := "pool,www_ou_edu_cms_servers",

so in this instance if a request came in for www.ou.edu/george it needs to fall through and go to the ouwww_bostitch pool.
Right now everything that doesn't match in the EDG goes to CMS pool.

3 Replies

  • If you're matching on "starts_with" then www.ou.edu/anything will always match to your CMS pool. If all of your class entries are hosts, you could get rid of [HTTP::Path] in the class match statement and use "equals" instead of starts_with. And BOOMER!

     

  • I probably gave a poor example, i don't think the equals will work either as there is alot pages that below a certain directory level, that would not be specified. so no the entries are not all hosts, sorry for not being clear.

    www.ou.edu/drumline := "pool,www_ou_edu_cms_servers",
    www.ou.edu/dreamspark := "redir,e5.onthehub.com/WebStore/Welcome.aspx?ws=2ea49795-ab9b-e011-969d-0030487d8897",
    www.ou.edu/dreamcourse := "pool,www_ou_edu_cms_servers",
    www.ou.edu/drc := "pool,www_ou_edu_cms_servers",
    www.ou.edu/drama := "pool,www_ou_edu_cms_servers",
    www.ou.edu/discover := "pool,www_ou_edu_cms_servers",
    www.ou.edu/disclaimer := "pool,www_ou_edu_cms_servers",
    www.ou.edu/disa := "pool,ouwww_bostitch",
    
    www.ou.edu/content/tulsa := "pool,www_ou_edu_cms_servers",
    www.ou.edu/content/ouit/all/researchit.html := "redir,www.ou.edu/content/ouit/research/researchit.html",
    www.ou.edu/content := "pool,www_ou_edu_cms_servers",
    
  • well it might not be eloquent but i decided i would check for the homepage first then go thru the EDG after the check. Then put the Last entry in the EDG going to the Fall thru pool

    when RULE_INIT {
      Turn Debug on or off (0=off 1=on)
      Turn debug off in prod
      set static::redir_debug 0
    }
    when HTTP_REQUEST {
      Use following to match against datagroup
       Use following to match against datagroup
      set match_string [string tolower [HTTP::host]]
      append match_string [string tolower [HTTP::path]]
      if {$static::redir_debug}{log local0. "Match String: $match_string"}
    
    
    Lookup the redirect or pool based upon match_string value
       set goto [class match -value [string tolower [HTTP::host][HTTP::path]] starts_with www_ou_edu_redir_class]
     if { ([HTTP::host] equals "www.ou.edu") } 
     if { ([HTTP::uri] equals "") }{
        pool www_ou_edu_cms_servers
      }
      if { [getfield $goto "," 1] equals "pool" } {
         if {$static::redir_debug}{log local0. "Pool declaration detected. Going to: [getfield $goto "," 2]"}
            pool [getfield $goto "," 2]
      } else {
         if {$static::redir_debug}{log local0. "Redirect declaration detected. Redirecting to: [getfield $goto "," 2]"}
           HTTP::redirect http://[getfield $goto "," 2]
      }
    }