Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require mailcap as a dependency for caddy repository packages #66

Open
flawedworld opened this issue Jun 7, 2021 · 6 comments
Open
Labels
enhancement New feature or request

Comments

@flawedworld
Copy link

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
caddyserver/caddy#3190
caddyserver/caddy#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.

@francislavoie francislavoie transferred this issue from caddyserver/caddy Jun 7, 2021
@francislavoie
Copy link
Member

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 francislavoie added the enhancement New feature or request label Jun 7, 2021
@flawedworld
Copy link
Author

@francislavoie on Debian 11 this file is provided by the media-types package and on Ubuntu 20.04 by the mime-support package

@francislavoie
Copy link
Member

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.

@flawedworld
Copy link
Author

flawedworld commented Jun 7, 2021

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.

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.

@francislavoie
Copy link
Member

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.

@girlbossceo
Copy link

I think we could just update our installation instructions to have mailcap on the apt install line. That might be good enough, frankly.

Has there been any changes in the documentation for this? Or any specific place in the docs that I could add this note?

I just ran into this exact problem when I was troubleshooting why my Fastly CDN was not sending clients a Content-Type from my origin server, as my website is a purely text/plain website, which also has UTF-8 emojis. And without a content-type: text/plain; charset=utf-8 being sent, emojis would not decode properly in browsers over Fastly CDN.

There wasn't any warning or message or anything saying Caddy was missing mailcap or such, so I sadly struggled on this for hours.

My opinion is indifferent on whether Caddy should ship MIME types or not, but at least a more clear message somewhere and maybe an info level log saying that mailcap should be installed would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants