Created
May 30, 2017 18:56
-
-
Save rezan/2b398534675f7d0e7258ef85a880a696 to your computer and use it in GitHub Desktop.
VCS session tracking
This file contains hidden or 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
vcl 4.0; | |
import cookie; | |
import std; | |
sub vcl_deliver | |
{ | |
cookie.parse(req.http.cookie); | |
set req.http.X-vcsid = cookie.get("_vcsid"); | |
if (req.http.X-vcsid == "") { | |
set req.http.X-vcsid = std.random(1, 10000000) + "." + std.random(1, 10000000); | |
set resp.http.Set-Cookie = "_vcsid=" + req.http.X-vcsid + "; HttpOnly; Path=/"; | |
} | |
std.log("vcs-key:SESSION/" + req.http.X-vcsid + "/" + req.http.Host + req.url); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment