Forum Discussion

mfkk531_168091's avatar
mfkk531_168091
Icon for Nimbostratus rankNimbostratus
Dec 05, 2015

Mobile Redirect Working; Mobile OptOut Not working. Please Help!

Hi,

For mobile redirect, we recently made changes and now we do NOT use redirect to a different website m.xyz.com, but just have mobile site on different servers in a pool and have f5 redirect to that pool if the useragent is mobile.

when HTTP_REQUEST {
     if { [class match [string tolower [HTTP::header User-Agent]] contains "mobile_agents" ] } {
     if {[HTTP::cookie MobileOptOut] eq 1} { return }
     if {[URI::query [HTTP::uri] MobileOptOut] eq 1} { return }         
           pool p-mobile-redirect
         }
    }

I'm currently facing issue where the MobileOptOut feature is not working.

I'm suspecting issue with cookies.

I have cookie persistence 1hr activated on the vip. so anything sent to mobile pool has a cookie inserted with mobile pool memeber.

When user hits OptOut, uri becomes ?MobileOptOut=1 he is sent to regular (desktop) pool and a new cookie with desktop pool member is inserted.

I want tio understand how will the cookie conflict rule? I mean who will supercede whom? Will the new desktop pool cookie work over the mobile pool cookie? or vice versa?

Thanks in advance!

1 Reply

  • Hi,

    the first condition will supersede next ones.

    but you need to change pool to default pool if you want to force the mobile to be sent to the default pool ...

    when CLIENT_ACCEPTED {
        Save the name of the virtual server's default pool before it's change in this iRule
       set default_pool [LB::server pool]
    }
    
    when HTTP_REQUEST {
        if { [class match [string tolower [HTTP::header User-Agent]] contains "mobile_agents" ] } {
            if {([HTTP::cookie MobileOptOut] eq 1) || ([URI::query [HTTP::uri] MobileOptOut] eq 1)} { pool $default_pool } else { pool p-mobile-redirect }
        }
    }