Forum Discussion

Bryce_Halkerst1's avatar
Bryce_Halkerst1
Icon for Nimbostratus rankNimbostratus
Apr 05, 2013

Data Group with iRule 301 Redirects

All,

 

My client had Aaron Hooley assist with creating data group 301 redirects, however, the initial url product is being picked up by the apache http class. I tried doing http:class disable, but apache is still fielding the request causing a 404. I would imagine that the 301 redirect would kick in to feed weblogic. Any ideas?

 

Thanks,

 

Bryce

 

 

Data Group 301s

 

"www.foo.com/product.asp?SKU=100151" := "301 http://www.foo.com/store/product/duracell-battery-packs/100151",

 

"www.foo.com/product.asp?SKU=11916015" := "301 http://www.foo.com/store/product/anna-griffin-jack-brag-book/1015158565?skuid=11916015",

 

"www.foo.com/product.asp?SKU=11839797" := "301 http://www.foo.com/store/product/anna-griffin-jack-photo-journal/1015158514?skuid=11839797",

 

Existing iRule

 

when HTTP_REQUEST {

 

if {[set code_url [class match -value -- [string tolower [HTTP::host][HTTP::uri]] equals datagroup301s]] ne ""}{

 

HTTP::class disable

 

HTTP::respond [getfield code_url " " 1] Location [getfield code_url " " 2]

 

}

 

}

 

HTTP Classes

 

ltm profile httpclass /Common/Weblogic {

 

app-service none

 

defaults-from /Common/httpclass

 

paths { glob:/store glob:/store* glob:/store/* glob:/qas/* }

 

pool /Common/Weblogic_Pool

 

redirect none

 

ltm profile httpclass /Common/Weblogic_STAGING {

 

app-service none

 

defaults-from /Common/httpclass

 

paths { glob:/store glob:/store* glob:/store/* glob:/qas/* }

 

pool /Common/Weblogic_Pool_STAGING

 

redirect none

 

Existing Root Responder irule

 

ltm rule /Common/BBB_root_res {

 

when HTTP_REQUEST {

 

log local0. "Request_uri: [HTTP::uri]"

 

if { ([HTTP::uri] equals "/") } {

 

HTTP::redirect "http://[HTTP::host]/store/"

 

}

 

3 Replies

  • Sorry I'm a bit unclear especially about your reference to 'Apache HTTP class' plus your statement that a 301 redirect would 'feed' Weblogic. Can you try and re-phrase the problem description please?
  • Steve,

     

    Hard one to explain, we are using http classes, so I pretty sure the new data group 301 redirect rule is not working due to the http classes. Apache http class is the catch all /* to port 80, Weblogic httpclass expressions are /store* and /store/* . When I try going to www.foo.com/product.asp?SKU=100151 I am getting a 404 to apache. 301 redirect data group is not redirecting to 301 http://www.foo.com/store/product/duracell-battery-packs/100151. I can go directly to http://www.foo.com/store/product/duracell-battery-packs/100151 and it is picked up by Weblogic. Need help logging the 301 redirect irule to see if it is even getting hits on the data group. I would appreciate any assistance.

     

    Thanks,

     

    Bryce
  • All,

     

    Meant to update the resolution a while back. Worked with Aaron to finalize the irule, we had to disable http classes and update the syntax.

     

    Thanks,

     

    Bryce

     

     

    Final working irule configuration:

     

    when HTTP_REQUEST {

     

    log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::uri] contains prod -> [class match -value -- [HTTP::uri] contains datagroup301s]"

     

    if {[set code_url [class match -value -- [string tolower [HTTP::host][HTTP::uri]] equals datagroup301s]] ne ""}

     

    {

     

    log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting [HTTP::uri] to ([getfield $code_url " " 1]) [getfield $code_url " " 2]"

     

    HTTP::class disable

     

    HTTP::respond [getfield $code_url " " 1] Location [getfield $code_url " " 2]

     

    } else {

     

    log local0. "[IP::client_addr]:[TCP::client_port]: No match for [HTTP::uri] in datagroup301s"

     

    HTTP::class enable

     

    }

     

    }