Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Use Caddy built-in file browser as an alternative #242

Open
maple3142 opened this issue Apr 10, 2024 · 3 comments
Open

Suggestion: Use Caddy built-in file browser as an alternative #242

maple3142 opened this issue Apr 10, 2024 · 3 comments

Comments

@maple3142
Copy link

Currently, caddy's builtin file browser can be enabled by changing Caddyfile to:

@protected path / /index.html /js/* /files/*

basicauth @protected {
        ...
}

# omitted...

route /files/* {
    uri strip_prefix /files
    file_server {
        root /data
        browse
    }
}

and to get Content-Type works correct (so that images and videos can be viewed or played in browser), mime database required by go needs to be avaiable (e.g. mounting /usr/share/mime/globs2)

Of course this is missing some feature that the current file browser supports (e.g. sharing), but it is good for people who want direct HTTP based file access.

The UI looks like this

image

@wahyd4
Copy link
Owner

wahyd4 commented Apr 10, 2024

Cool, it sounds good, then we can make filebrowser optional.
Would your like to make a PR for this?

@maple3142
Copy link
Author

Of course

I am wondering should this be in a different path than /files (maybe /fs) that it can coexist with existing file browser, and both filebrowser and caddy file_server can be enabled/disabled separately? I am not sure how to handle this with current multiple Caddyfile setup.

@wahyd4
Copy link
Owner

wahyd4 commented Apr 10, 2024

Yeah, I think we can use /fs for the Caddy file server one.
Regarding the multi Caddyfile setup, most of them are the same, the only difference is SecureCaddyFile will be used when user turns on authentication by enabling ENABLE_AUTH.
So most likely you can put the same contents into the 2 files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants