Forum Discussion

JustCooLpOOLe's avatar
JustCooLpOOLe
Icon for Cirrocumulus rankCirrocumulus
Jan 18, 2022

Present Message to User during ACCESS_POLICY_AGENT_EVENT iRule

Hi,

I'm trying to write an iRule that is triggered during an APM policy (iRule Event) that will check the platform OS and version. If it's lower than a certain value, I want to reject the user but present a message to them indicating that they contact their System Administrator. I have the logic to reject or drop the connection but I'm unable to replace a reject/drop with an iFile or HTTP Redirect. I'm just trying different options. Any ideas?

when ACCESS_POLICY_AGENT_EVENT {


    # iRule Event is called "test_me"
    if { [ACCESS::policy agent_id] == "test_me"} {


        # Variable Section
        set min_ios_ver "15.1"
        set min_android_ver "12"
        set user_platform [ACCESS::session data get "session.client.platform"]
        set user_version [ACCESS::session data get "session.client.platform_version"]


        # Checks to see if the platform is iOS and version is allowed
        if { $user_platform == "iOS" and $user_version < $min_ios_ver } {


            reject
                
            if { $static::irule_debug == 1} { log local0. "Does not meet minimum version requirement" }


        }


        # Checks to see if the platform is iOS and version is allowed
        if {$user_platform == "Android" and $user_version < $min_android_ver } {


            drop


            if { $static::irule_debug == 1} { log local0. "Does not meet minimum version requirement" }


        }



    }



}