1. Caddy version (caddy version
):
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
2. How I run Caddy:
caddy.service file (not API)
or
caddy start/stop/reload
a. System environment:
Raspberry Pi (Raspbian Buster Lite)
b. Command:
caddy start --config <path to file>
caddy reload --config <path to file>
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
mydomain.duckdns.org {
log {
output file /var/log/caddy/portainer.log
format console
}
@internal {
remote_ip 192.168.0.0/16
}
handle @internal {
reverse_proxy 127.0.0.1:9000
}
respond 403
}
jellyfin.mydomain.duckdns.org {
log {
output file /var/log/caddy/jellyfin.log
format console
}
reverse_proxy 127.0.0.1:8096
}
omv.mydomain.duckdns.org {
log {
output file /var/log/caddy/omv.log
format console
}
reverse_proxy 127.0.0.1:81
}
nas.mydomain.duckdns.org {
log {
output file /var/log/caddy/nas.log
format console
}
root * /srv/dev-disk-by-label-HomeDrive/
@noAccess {
not path */RESTRICTED/*
}
file_server @noAccess browse {
hide RESTRICTED Games "TV SHOWS"
}
encode gzip
basicauth {
username (hashbrown64)
}
@iPhone {
not remote_ip xxx.xxx.xxx.xxx
}
respond @iPhone 403
}
3. The problem I’m having:
I am trying to figure out the secret recipe for hiding files properly in Caddy v2. I understand that folders/files can be denied by using a ‘named matcher’ with ‘not path’ and calling that out in the file_server directive which I am using for my ‘RESTRICTED’ folder.
Using that method is great but any user can still see the folder (although access is denied) and I would like to have it invisible to all as well as denying permission.
I have tried many variations of using the hide
module and it does work very well. My problem is I can’t figure out how to make it only hide one instance of a named folder and not all of them.
4. Error messages and/or full log output:
5. What I already tried:
As you see in my caddyfile I have one folder with not path
and then I also hid that folder along with another called Games
and one called “TV SHOWS”.
@noAccess {
not path */RESTRICTED/*
}
file_server @noAccess browse {
hide RESTRICTED Games "TV SHOWS"
}
It does exactly what I want it to do except all of my Games
folders in every directory are hidden. I only want to hide one Games
folder and that’s the one in …Arcade/Games
I have tried all of these:
hide RESTRICTED /srv/dev-disk-by-label-HomeDrive/Arcade/Games "TV SHOWS"
hide RESTRICTED */srv/dev-disk-by-label-HomeDrive/Arcade/Games "TV SHOWS"
hide RESTRICTED */srv/dev-disk-by-label-HomeDrive/Arcade/Games*
hide RESTRICTED */Arcade/Games "TV SHOWS"
hide RESTRICTED /Arcade/Games "TV SHOWS"
hide RESTRICTED /Arcade/Games* "TV SHOWS"
hide RESTRICTED */Arcade/Games/* "TV SHOWS"
And probably a few other things. I have also separated the hidden folders with a semi-colon which works but still doesn’t allow me to hide just one directory. i.e. hide RESTRICTED ; Games ; "TV SHOWS"
I’m sure there’s a way to get the desired results but I just can’t crack the code.
Any help would be greatly appreciated.