How can I enable http auth in lighttpd for all directories except one?

Posted by Nuri Hodges on Server Fault See other posts from Server Fault or by Nuri Hodges
Published on 2011-02-15T18:22:53Z Indexed on 2013/11/11 3:58 UTC
Read the original article Hit count: 445

I am trying to authenticate access to everything in webroot (/) except anything that resides in a particular directory (/directory/) and I've tried both of these options to no avail:

$HTTP["url"] =~ "^(?!(/directory))" {
    auth.require = ( "" =>
            (
            "method" => "basic",
            "realm" => "auth to this area",
            "require" => "user=username"
            )
    )
}

$HTTP["url"] != "/directory" {
    auth.require = ( "" =>
            (
            "method" => "basic",
            "realm" => "auth to this area",
            "require" => "user=username"
            )
    )
}

© Server Fault or respective owner

Related posts about lighttpd

Related posts about http-basic-authentication