1. Caddy version (caddy version
):
v2.2.1
2. How I run Caddy:
sudo caddy run --watch
and open browser to http://localhost:8456
a. System environment:
Ubuntu 20.04
b. Command:
sudo caddy run --watch
d. My complete Caddyfile or JSON config:
{
admin off
http_port 8456
}
localhost:8456 {
file_server browse {
root ./dist
}
@notFound {
not file
}
rewrite @notFound default.jpg
}
3. The problem I’m having:
This is my folder structure
I expect the test page to show default.jpg for missing image.
But, all images fall back to default.jpg
5. What I already tried:
I’ve try move Caddyfile to /dist folder, remove root ./dist
, execute caddy run
from that directory everything works fine.
I just want to know how to propery set rewrite when file not found to something when root is not current working directory.
Thank you.