Last active
November 8, 2020 13:11
-
-
Save cdgraff/6b685b0baba2cb6369c90b845f00cf42 to your computer and use it in GitHub Desktop.
Varnish VCL code examples for HLS stats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub vcl_recv { | |
# Only userid are left in req.http.cookie at this point. | |
cookie.parse(req.http.cookie); | |
cookie.filter_except("userid"); | |
if (cookie.isset("userid")) { | |
std.log("userid value is: " + cookie.get("userid")); | |
} else { | |
cookie.set("userid", regsub(std.random(0, 320000000), "\..*", "")); | |
std.log("userid value is: " + cookie.get("userid")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment