Require mailcap as a dependency for caddy repository packages
Caddy uses the distribution provided /etc/mime.types file to set Content-Type headers on files, however not all systems ship with /etc/mime.types by default which is packaged as part of mailcap. Caddy packages from the official repositories do not require this package currently. Without this package, files may be sent to browsers without a Content-Type header. For example out of the box without mailcap installed on RHEL 8, Caddy does not set a Content-Type for txt files.
Relevant related comments and issues: https://discussion.fedoraproject.org/t/caddy-caddy/8578/5 https://github.com/caddyserver/caddy/issues/3190 https://github.com/caddyserver/caddy/issues/3959
NGINX and Apache httpd bundle their own mime.types files avoiding the distribution mime.types. https://github.com/nginx/nginx/blob/master/conf/mime.types https://github.com/apache/httpd/blob/trunk/docs/conf/mime.types
Caddy would ideally bundle its own list of mime types in the long run to avoid relying on distributions to provide up to date correct and relevant mime types.
Caddy would ideally bundle its own list of mime types in the long run to avoid relying on distributions to provide up to date correct and relevant mime types.
I don't think we want to take on the burden of bundling our own. I think it's better to rely on whatever the system has for you.
/cc @carlwgeorge for the RPM package; I'll look into this for the DEB.
@francislavoie on Debian 11 this file is provided by the media-types package and on Ubuntu 20.04 by the mime-support package
So that's the trouble, the .deb we ship is distro-less. That's the risk in adding a require to it, cause if the distro doesn't ship something with that exact name, installing Caddy would fail.
So that's the trouble, the
.debwe ship is distro-less. That's the risk in adding arequireto it, cause if the distro doesn't ship something with that exact name, installing Caddy would fail.
On RPM packaging this should not be an issue as you can conditionally require dependencies based on the distribution. See: https://docs.fedoraproject.org/en-US/packaging-guidelines/DistTag/
Unsure about DEB packaging. Newer Debian and Ubuntu releases provide a transitional package meaning you could just require mime-support and it would work on all currently supported versions of Ubuntu and Debian.
I'm not sure about this one.
I think we could just update our installation instructions to have mailcap on the apt install line. That might be good enough, frankly.