Skip to content

Instantly share code, notes, and snippets.

@section-io-gists
Last active June 2, 2020 01:50
Show Gist options
  • Save section-io-gists/f553f548245848387feb200de709bc90 to your computer and use it in GitHub Desktop.
Save section-io-gists/f553f548245848387feb200de709bc90 to your computer and use it in GitHub Desktop.
basicAuthVCL4.vcl
sub vcl_recv {
if (! req.http.Authorization ~ "Basic dXNlcm5hbWU6cGFzc3dvcmQ=") {
# This is checking for base64 encoded username:password combination
return(synth(401, "Authentication required"));
}
unset req.http.Authorization;
}
sub vcl_synth {
if (resp.status == 401) {
set resp.status = 401;
set resp.http.WWW-Authenticate = "Basic";
return(deliver);
}
}
@edysmp
Copy link

edysmp commented Jun 2, 2020

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment