Minor thing, but I recommend using the root
directive instead, like this:
root * {env.HOME}/Downloads
file_server browse
This is because the root
directive sets it site-wide, so if you need to add another directive that needs to be aware of root
, itâll already be ready for you. The root
subdirective within file_server
is typically meant for when you want to override the site-wide root
for some reason.
You can do this instead:
reverse_proxy /shark h2c://127.0.0.1:2001
Just in case you werenât aware, /shark
will only match exactly /shark
and not /shark/foo
, because Caddyâs path matching is exact. Add a *
to the end of the matcher to make it match other paths too.
Yeah, I see the problem â running caddy adapt
on your config shows that the route with mail2.lilf.ir
is after the one for :443
. This looks like a bug with the Caddyfile adapter where site blocks with multiple sites including a catch-all will be sorted with the âpowerâ of the longest hostname in that site. Fixing that bug might be kinda tricky.
The fix though is to split up your :443
and np.zii.lilf.ir
into their own sites such that they each get handled separately. Doing that, the :443
site will get properly sorted to the end.
You can make use of Caddyfile snippets to avoid duplication though, so you can have one snippet with the site contents that you import into both sites:
FYI @matt bug with the site sorting