Skip to content

Instantly share code, notes, and snippets.

@cdgraff
Created February 20, 2017 00:05
Show Gist options
  • Select an option

  • Save cdgraff/88f5e6449956ad9c9882e9f1962682a7 to your computer and use it in GitHub Desktop.

Select an option

Save cdgraff/88f5e6449956ad9c9882e9f1962682a7 to your computer and use it in GitHub Desktop.
sub vcl_deliver {
std.log("userid:" + cookie.get("userid"));
std.log("url:" + req.url);
set resp.http.Access-Control-Allow-Origin = "http://your.site.here";
set resp.http.Access-Control-Allow-Credentials = "true";
if (resp.http.Content-Type ~ "application/vnd.apple.mpegurl") {
# Set a userid cookie on the client that lives for 60 minutes.
set resp.http.Set-Cookie = "userid=" + cookie.get("userid") + "; Expires=" + cookie.format_rfc1123(now, 60m) + "; httpOnly";
}
return(deliver);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment