Browse Default Template?

1. My Caddy version (caddy -version):

0.10.10 Docker for unraid

2. How I run Caddy:


a. System environment:

Unraid Docker

b. Command:


c. Service/unit/compose file:


d. My complete Caddyfile: {
bind {$ADDRESS}
root /var/www
basicauth / UN PW
browse /Personal
tls domain
tls /certs/certificate.crt /certs/private.key

3. The problem I’m having:

Browsing and downloading files from one place to another. MKV files stream when I don’t want and I have lots of pictures / nfo / files not related to what I am viewing.

4. Error messages and/or full log output:


5. What I already tried:

Looked around for 5 or so hours for the basic template

6. Links to relevant resources:

None, Searched this forum and github, etc.

Hey there,

Happy to start using caddy and on unraid, I been looking for an all in one package / docker instead of running bloated VMs with file sharing type HTTP FTP software on them.

I really like the browse functionality, and it was real simple, just one command in the caddy file.

I have two issues I am trying to narrow down / fix.

  1. Downloading my videos works fantastic, unless it is an MKV file, then it tries to play in the browser… Which I don’t mind at times, but I would prefer for a download instead as well. Is there a way to make it default to download on clicks? Pictures, Text Files, Videos, etc… some of them open in the browser and I would prefer not to.

  2. How do I hide files with certain extensions?

I looked at other template files which I could build one, I was looking to see if I could modify the basic one since it works perfectly in all other areas. Looks good, filter on it, etc. Is it hidden somewhere on github or am I going to need to write a browse template from scratch?

Please let me know,



Hi Chris, welcome!

This is a good feature request for v2 (currently in beta). Browsers will typically download a file if the MIME type is not something it can render in the browser, or if there’s a special header to treat the response as an “attachment” (download). Perhaps there should be an option to tell browse that it should always add that header for files, or at least certain types of files (based on file extension).

Edit: Actually, you can already add headers in Caddy 2 separately from the browse template (or with the Caddyfile).

Do you want to hide them only from the file listing or from being accessed at all (i.e. what if there is a request where the path is for that file)?

Hi There,

I think I read that </a download href> </>with download in the tag would mark it correctly, but would need to put that in the template listing I believe.

Hiding extensions is fine, It isn’t a public site or anything, it just cleans up the many pictures around the certain folders I have.

I was thinking if there was a quick way in the caddyfile to have these? Or if there was a way to edit the current browse template file, I am sure it could be a quick 10 min fix.

Also is v2 available in a docker for unraid?

Let me know,


I have figured out the template file with download

{{if .IsDir}}
<\a href="{{.URL}}">{{.Name}}
<\a download href="{{.URL}}">{{.Name}}

I am still struggling with being able to hide the extension. I have came close with this…

{{if and (ne .Name “ignore”) (ne .Name “.nfo”)}}

It ignores the folder ignore, however I cannot seem to get it to ignore a file extension type. I tried (ne .Name “*.nfo”) and regex expressions but cannot seem to get it to work. Is there a way for the name to have variables or regular expressions?

In the Template Actions doc, there’s some common functions outlined.

Among them is .Ext, to which you can feed a string and receive the file extension. You can then use that to compare to ".nfo" to determine whether or not to ignore it.

Thanks for the guidance!

I have been trying to use this and I can’t seem to understand how it should work. I am a programmer in many other languages, and this {{}} type of if statements are kinda confusing and limiting I am finding.

How would you use .Ext in the current if statement?

{{if and (ne .Name “ignore”) (ne .Name “.nfo”)}}

I have tried

{{if and (ne .Name “ignore”) (ne .Name.Ext “.nfo”)}}


{{if and (ne .Name “ignore”) (ne .Ext .Name “.nfo”)}}

And many other forms.

Is it possible or am I missing something or require more brackets somewhere?

Let me know, it would be extremely helpful!


Yeah, I got a bit of this too. Difference between programming and templating, I guess.

I figured it would be something like:

{{if and (ne .Name "ignore") (ne (.Ext .Name) ".nfo")}}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.