How to check if file is exists?

My caddy version:
v2.5.2 h1:eCJdLyEyAGzuQTa5Mh3gETnYWDClo1LjtQm2q9RNZrs=

I have a file_server directive. I wonder if there is a way for caddy to detect if the file doesn’t exists?

root * /var/www/web/{labels.2}
file_server
# if file doesn't exists then redirect

I can’t find anything related to this on the docs: file_server (Caddyfile directive) — Caddy Documentation

Thank you for the help.

You can use handle_errors (Caddyfile directive) — Caddy Documentation for that :innocent:

Please update. The latest version is Release v2.6.2 · caddyserver/caddy · GitHub

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.