Customizing the file_server index page

1. Caddy version (caddy version):

v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=

2. How I run Caddy:

caddy run via Systemd Service file

a. System environment:

Debian 11 (bullseye)

3. The problem I’m having:

This is less of a problem, more of a question: I’d like to customize the page that file_server browse uses to display a directory listing and am wondering if there are directives to do that via the Caddyfile or whether using templates is the right approach.

4. What I already tried:

I haven’t looked into templates super closely, but it appears that this documentation page might be a good place to start. I also came across the default browse template on Github— is that something that can be duplicated and then used as a template or is that functionality not available in the Caddy configuration?

Thanks for your help!

See the file_server (Caddyfile directive) — Caddy Documentation, you can pass a filename to browse (you must use a block { } to specify it though) which is the replacement template file you want for the index.

file_server {
	browse /path/to/your/custom.template

Oh awesome, thanks @francislavoie must’ve missed that, cheers!

1 Like

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