Caddy filebrowser rewrite

Very happy filebrowser 2.0 release.
Tracked web requests.

log stdout


The difference is resource becomes resources .
After modifying rewrtie, the home page got a black screen and could not do anything.

It seems that rewrite won’t jump?
Folder structure: C:…\Desktop\www\test, All the files needs to share are in test folder.

rewrite { 
if {path} ends_with resources/
to /api/resources/test

rewrite { 
if_op and
if {path} has resources
if {path} not_ends_with resources/
if {path} not_has test
to /forbidden


Hey! A black screen? Could you take a screenshot please?

1 Like

It seems that the home page has opened an unknown file and cannot be cancelled. The X in the upper left corner is invalid.

Delete two rewrites, everything works fine.
URL manually enter files/test, everything works fine.

No matter how you rewrite the path, the home page will not execute, always /api/resources/. All other modules have been blocked.

Tested v2 2.0.1 2.0.2

@hacdias, v1 is running very well. I want to rewrite all path to /api/resources/test

I wouldn’t recommend you to do those rewrites. Probably that’s why you’re having issues. Why do you need that?

I need these rewrites to force the filebrowser directory to be restricted to the /test/ directory, because the filebrowser permissions are very high, and the admin permissions can control the entire server.
Just change the directory range in the settings, fill in the absolute path, you can read and write to the server’s system directory or root directory. It is not controlled by the root setting of the caddyfile at all.

These two very simple path rewrites, no problems with v1 support.

1 Like

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