Last active
June 2, 2020 01:50
-
-
Save section-io-gists/f553f548245848387feb200de709bc90 to your computer and use it in GitHub Desktop.
basicAuthVCL4.vcl
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
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); | |
} | |
} |
echo dXNlcm5hbWU6cGFzc3dvcmQ= | base64 --decode
username:password
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to generate base64-encoded string with login and password you can use this command:
echo -n "USER:PASSWORD" | base64