Mobile Device irule redirect behind Akamai results in Forbidden Error

Could use some help to determine if the iRule is written in a proper manner.

If the /URI is blank or just /, it will result in a Forbidden error by Akamai. If it has a /URI of any value or bypassing Akamai, then it will function correctly. I do have a Splash page iRule for all devices to redirect to the home page URI if the URI request is just “/” but that doesn’t seem to be triggering even though its higher on the iRule list, but I have not set priority yet.

iRule is applied to www.foo.com virtual server and need smartphones (data group = Mobile_Redirected_Devices) to redirect to mobile:

when HTTP_REQUEST { set qvalue [URI::query [HTTP::uri] refundInfo] if { [class match -- [string tolower [HTTP::header “User-Agent”]] contains Mobile_Redirected_Devices] && [HTTP::path] eq “/cancel/orderCancellation” and $qvalue ne “” } { HTTP::redirect “https://mobile.foo.com/cancelOrderVerify.action?token=$qvalue” } elseif { [class match -- [string tolower [HTTP::header “User-Agent”]] contains Mobile_Redirected_Devices] } { HTTP::redirect https://mobile.foo.com/panera } }

Hi,

How is your data group item? Is stored in lower case?

I do not know if I understand, but, following the reasoning, I would do so:

Data group:

ltm data-group internal Mobile_Redirected_Devices { records { mozilla { data mozilla } } type string }

iRule:

when HTTP_REQUEST { 
    if { [class match -- [string tolower [HTTP::header "User-Agent"]] contains Mobile_Redirected_Devices] } {
        if { [HTTP::path] eq "/cancel/orderCancellation" and [URI::query [HTTP::uri] refundInfo] ne "" } {
            HTTP::redirect "https://mobile.foo.com/cancelOrderVerify.action?token=[URI::query [HTTP::uri] refundInfo]" 
        } else {
            HTTP::redirect "https://mobile.foo.com/panera"
        }
    } 
}

Test 1:

Request: https://www.foo.com

Response: https://mobile.foo.com/panera

Test 2:

Request: https://www.foo.com/somepath?somequery

Response: https://mobile.foo.com/panera

(The configuration rule out the URI, okay?)

Test 3:

Request: https://www.foo.com/cancel/orderCancellation?refundInfo=1

Response: https://mobile.foo.com/cancelOrderVerify.action?token=1