Forum Discussion

Phil_102636's avatar
Phil_102636
Icon for Nimbostratus rankNimbostratus
Oct 01, 2012

Irule with URI redirect works but keeps sending to old link

 

I have a working irule that does a URI redirect to another site but if by chance someone has the old link it continues to send it to the original URL if they put some other characters in it, like for tracking purposes from old code.

 

Below is what I have with a data class. I figured there might be a way to redirect regardless of any tracking link that might be cached somewhere on the net.

 

Thanks for any advice or help.

 

Data Group name = uri-redirect

 

Data Group = /stuff: = https:/someplace.com

 

Irule

 

Determine if you are trying to go to a site that has a URL

 

which looks at "uri-direct "data class and does not find anything in the "other-variables" Data Class. The problem is there must be old links out there so when they go to the old uri and put in a random characters’ it does not redirect.

 

if {([class match [string tolower [HTTP::uri]] eq uri-redirect]) and not ([class match [string tolower [HTTP::header User-Agent]] contains other-variables])}{

 

HTTP::redirect [class match -value [string tolower [HTTP::uri]] eq uri-redirect]

 

} else {

 

Do nothing

 

 

 

 

  • Are you talking about extra characters "/stuff"?

     

     

    If so I'd suggest using a starts_with operator:

     

     

    if { [class match [string tolower [HTTP::uri]] starts_with uri-redirect] }