For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Svevak_211593's avatar
Svevak_211593
Icon for Nimbostratus rankNimbostratus
Mar 15, 2016

Geoblocking/whitelisting with video

Hi at all,

I want to give the user a video back if he's from a geoblocked country or not on the whitelist. Also I need to check if the user needs an online or mobile version of the video.

This is what I've done so far...

when CLIENT_ACCEPTED {
    if { [class match [IP::client_addr] equals datagroup-xyz] } then {
        pool xyz-http-dsr-pool
    } else {
        switch -exact -- [whereis [IP::client_addr] country] {
            "DE" -
            "AT" -
            "CH" -
            "LI" -
            "LU" {
                pool xyz-http-dsr-pool
            } 
            default {
          reject
            }
        }
    }
}

when HTTP_REQUEST {
    HTTP::redirect "http://hostname.com/path/to/video/GEO.f4m"
    switch -glob [HTTP::path] {
        "*.f4m"  { set http://hostname.com/path/to/video/GEO.f4m}
        "*.m3u8" { set http://hostname.com/path/to/video/GEO.m3u8}
        "*.xml" { set http://hostname.com/path/to/video/GEO.xml}       
        default { set file_extension -}   
    }   
}

Hope you understand my question.

Regards, Daniel

1 Reply

  • Hello,

     

    Finalling, just need to identify if it's mobile or desktop browser to complete your irule. You can do it following two way :

     

    1- inserting an answer with a js code to get info identifying the browser resolution, browser info, etc.

     

    2- Checking the User-Agent header against a database to determine if this is mobile or desktop (can be done using iRuleLX (v12) or using sideband connections to an external REST API)