Skip to main content

HTTP_COOKIE

Vasyl MartyniukLess than 1 minute

Syntax

${HTTP_COOKIE.<cookieName>}

Definition

Get data from the PHP super global $_COOKIEopen in new window. The value from the $_COOKIE is extracted AS-IS, so it is important to control the actual value data type by casting it accordingly. Refer to the Typecasting section for more detail.

The below example denies access to several urls if wp-referral cookie does not contain one of the white-listed domains.

{
    "Effect": "deny",
    "Resource": [
        "URI:/category/science-tutorials",
        "URI:/category/animation-tutorials"
    ],
    "Condition": {
        "NotIn": {
            "${HTTP_COOKIE.wp-referral}": [
                "myawesomescience.com",
                "google.com"
            ]
        }
    }
}
Virtual Assistant