Forum Discussion
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)
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com