Basicauth does not work - can access files without login

Caddyfile:

localhost:3333

basicauth /home/m/Downloads Bob hiccup
browse
root /home/m/Downloads
gzip
log access.log

When I access localhost:3333 I would expect a login prompt asking for the name and password, but I can just access the folder without a login. Am I doing anything wrong?

And can I use root as the path for basicauth? So that I get a login prompt on the start directory? Something linke

root /home/m/Downloads
basicauth root Bob hiccup

Best regards

https://caddyserver.com/docs/basicauth

With your basicauth config you are only protecting localhost:3333/home/m/Downloads, if you want to protect localhost:3333 you need to change /home/m/Downloads to /.

1 Like

Thank you very much!

Is it possible to set multiple basicauth for different subfolders or subsubfolders to have something like a simple account management?

And is there a template or already implemented function to give people readonly and/or upload rights to add new files to the file server through the template site (like a upload button or something like that)?

Best regards

Should work.

basicauth /path1 user1 user1

basicauth /path2 user2 user2

to the readonly/upload rights. no idea. Sorry :confused:

That does not work with 2x basicauth, the second one gets ignored :confused:.

Oh, you’re right. It works, but in a weird way.

basicauth /path1 user1 user1

basicauth /path2 user2 user2

Works, but when i login at /path1 i don’t have to login at /path2 Oo

Basic auth is very simple. Hence the name, basic. Although we may upgrade its capabilities slightly in the future, the fundamental spec of basic authentication is still very basic. :wink:

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.