Hi,

On Tue, Jan 31, Artur wrote:
> Hello,
> 
> I'm currently serving public static content from a webserver behind haproxy.
> What could be the right way to password protect only a single
> subdirectory (and all its content) with haproxy ?
> / -> Public
> /directory/private -> Password protected

You could try with something like this:

userlist testlist
    user test insecure-password test

your listen/frontend:
        acl need_auth path_beg /directory/private
        acl auth_ok http_auth(testlist)

        http-request auth if need_auth !auth_ok

For more information check userlists / auth docs:
https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#3.4
https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#7.3.6-http_auth
https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4.2-http-request

-Jarno

-- 
Jarno Huuskonen

Reply via email to