Forum Discussion

Scott_85521's avatar
Scott_85521
Icon for Nimbostratus rankNimbostratus
Sep 29, 2008

handle 404 - LB::reselect and HTTP_CLASS rewrite ----- conflict

Hi Guys,

 

I have a sticky one... I am deploying a new site and HTTP_CLASSES have been used to handle the delegation of traffic to various applications based on URI, there is a catch-all class that matches on the URI glob pattern /*, this (default) class prepends the URI with the default application name.

 

 

If this application throws a 404, we want to handle this in an iRule to iterate over additional (legacy) applications, passing them the original URI. The problem... the application see the application name that was prepended by the iRule. I have "sting mapped" the request string to force its remove, no luck, the class still re-writes the URI. Forcing class selection on the HTTP_REQUEST yields the following error: TCL error: handle404.destinations.iRule.devint - Illegal argument (line 5) invoked from within "HTTP::class select httpclass".

 

 

The code for this rule:

 

 

 

when CLIENT_ACCEPTED {

 

initate re-try counter

 

set retries 0

 

}

 

 

when HTTP_REQUEST {

 

set request [HTTP::request]

 

 

if { $retries eq 1 } {

 

strip the newapplicaiton string from the URI

 

set request [string map {/newapplication /} [HTTP::request]]

 

 

Attempt to force the use of the default httpclass [no rewriting], this does NOT work

 

HTTP::class select httpclass

 

}

 

}

 

 

when LB_SELECTED {

 

log $retries

 

log $request

 

 

If we are re-trying, hop tp the next pool. Once the URI thing is sorted additional conditions/pools will be added

 

if { $retries eq 1 } {

 

LB::reselect pool webpool.legacy.dev

 

}

 

}

 

 

when HTTP_RESPONSE {

 

log [HTTP::status]

 

 

if we get a 404 increment the retry counter and retry the request.

 

if { [HTTP::status] eq "404" } {

 

incr retries

 

HTTP::retry $request

 

}

 

}

 

1 Reply

  • HTTP::retry triggers the full request side chain of events as if it was a new request. Your workaround of saving the original URI seems valid.

     

     

    Aaron