In my dev environment, I have a few users configured to use Basic authorization
(configured in the Nginx backend) and I'd like to be able to perform VSL
queries based on the auth user. This is what I was able to come up with, but
I'm wondering if there is a simpler way that I'm just not seeing.
require blob;
if (req.http.Authorization) {
set req.http.X-Auth-User = regsub(blob.encode(IDENTITY,
blob=blob.decode(BASE64,
encoded=regsub(req.http.Authorization, "^Basic (.*)", "\1"))),
":.*$", "");
}
varnishtop -I ReqHeader:X-Auth-User
varnishlog -i ReqURL -q 'ReqHeader:X-Auth-User ~ "someuser"'
Thanks,
Justin
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc