vcl 4.0;
import std;
sub vcl_recv {
# Retrieve WordPress logged in username, store it in a custom http x-header and clean cookie
if (req.http.Cookie ~ "wordpress_logged_in") {
set req.http.X-UserID = regsuball(req.http.Cookie, "^.*wordpress_logged_in_[^=]+[^;]=([^;]*);*.*$", "\1");
set req.http.X-UserID = regsuball(req.http.X-UserID, "%7C.*", "");
# Remove wordpress_logged_in and wordpress_ cookies
set req.http.Cookie = regsuball(req.http.Cookie, "wordpress_logged_in_[^=]+[^;]+(; )?", "");
}
}