Forum Discussion

ukitsysadmin_95's avatar
ukitsysadmin_95
Icon for Nimbostratus rankNimbostratus
Jan 18, 2011

matchclass http::path compare question

I was wondering is anyone can help.

 

 

We are upgrading our site and changing the DB structure which means all our old http::paths will no longer work and need redirecting to the new http::path, the http::header will stay the same every time.

 

 

 

We have about 40,000 http::paths that will need redirecting

 

 

 

The http::host, will stay the same every time e.g. www.bob.com

 

 

 

I was thinking of placing all the old http::paths into an external data group

 

 

 

e.g.

 

 

 

old_paths

 

 

 

/office/1/bob

 

/office/2/sue

 

/office/3/brian

 

/office/4/zoe

 

/office/5/ted

 

+40,000 more in this format

 

 

 

The numbers in the path reference the DB id's

 

 

 

the new_paths (are almost the same but the DB id's)

 

 

 

/office/57643/bob

 

/office/48473/sue

 

/office/26363/brian

 

/office/42939/zoe

 

/office/52733/ted

 

+40,000 more in this format

 

 

 

The old Paths will produce a status 404, once we switch over

 

 

 

so is it possible

 

 

 

when HTTP_REQUEST {

 

if { [matchclass [HTTP::path] ends_with $::old_urls] } and { status equals 404 {

 

 

{ [matchclass [HTTP::path ends_with $::new_urls] } redirect {

 

 

 

 

 

What I mean is

 

if the http::path ends with any of the 40,000 "old_url" entries then search the "new_urls" if a match,

 

redirect the http:host + http::path "new_url"

 

 

 

e.g. some ones bookmark =

 

www.bob.com/office/5/ted

 

 

 

irule should take "ted", which is listed in "old_url" external data group,

 

search the "new_url" for http::path which ends_with "ted"

 

then take full http::path which "ted" ends with and append to http::host

 

 

 

e.g.

 

www.bob.com/office/52733/ted

 

 

 

Note: all the "end_with" text are individual so NO duplicate, thus my request should not cause any problems (if that makes sense)

 

 

 

 

 

We are currently using BigIP LTM version 9.4.7

 

 

 

 

Regards

 

 

 

J

 

1 Reply

  • You can definitely accomplish this with data groups. I don't suppose you can upgrade to 10.x?

     

     

    I imagine using "class search - value" is going to be much more efficient than extracting a value with match class.

     

     

    I understand your old_urls class is what would contain the paths, but am a bit confused about what you'd like to do if there's a match? It looks like you want to send the user a redirect? Will that redirect send them to a value to which the old url corresponds?