Add Content-Type image/avif

Hello Guys,

For some reasons, I need to open the AVIF file directly instead of referencing it on HTML.

But Caddy does not seem to have the Content-Type of AVIF

I try to add it manually:

header /path/to/file.avif {
	Content-Type "image/avif"

It works, but I don’t want the path. Is there a wildcard method?


You can do it with a path matcher like this:

@avif path *.avif
header @avif Content-Type "image/avif"

For what it’s worth, the content types are provided by your system’s mime package (which the Go stdlib just references). You could look into whether it has it or not.

1 Like

Looks like it was added to xdg-mime only a year ago, so it might not have landed on your system yet :man_shrugging: but just making a wild guess as to what mime implementation you have.

1 Like

Thank you!
I checked the Ubuntu shared-mime-info package information and it is indeed out of date.


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