Is there a convenient way to password-protect URLs which match a certain pattern in Lighttpd?
I thought about matching regex, but any other creative solution will be nice.
NOTE : I'm not looking for a way to password-protect a directory, beacuse the URLs I want to protect aren't confined to a certain directory structure.
Adam
Have you looked at the mod_auth
plugin?
auth.debug = 0
auth.backend = "plain"
auth.backend.plain.userfile = "/full/path/to/auth-file.txt"
auth.require = ("example.com" =>
(
"method" => "basic",
"realm" => "Password protected area",
"require" => "user=username"
)
And the auth-file would contain (for basic authentication):
username:password
More info: http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModAuth
To filter / check a specific directory,
$HTTP["url"] =~ "^/download(s)?$" {
auth.require = ( "" =>
(
"method" => "basic",
"realm" => "Passworded Area",
"require" => "user=username"
)
)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With