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

Deriving mime type inconsistent with Go 1.17 #4287

Closed
cubic3d opened this issue Aug 17, 2021 · 3 comments
Closed

Deriving mime type inconsistent with Go 1.17 #4287

cubic3d opened this issue Aug 17, 2021 · 3 comments
Labels
upstream ⬆️ Relates to some dependency of this project

Comments

@cubic3d
Copy link

cubic3d commented Aug 17, 2021

Looks like Go 1.17 changed the source for mime types (golang/go#46013) it's no longer sources from mailcap using /etc/mime.types but from the Shared MIME-Info Database at /usr/share/mime/.

So if I use the official build from current version 2.4.3 and request a file from localhost/file.ign I get the correct header Content-Type: application/vnd.coreos.ignition+json. Building the same version with xcaddy with Go 1.17 will not set a content type because application/vnd.coreos.ignition+json is not part of the shared database on my system it looks like. More popular types like text/plain work fine.

Is there a way to make the lookup more consistent and remove the external dependency? Maybe embedding mime types in the Caddy binary?

@francislavoie
Copy link
Member

Hmm. No, Caddy doesn't have anything built-in for overriding MIME types right now.

I think you should open an issue upstream to report this problem, since this is a regression that they introduced.

I would expect that if no MIME type is found in your shared DB, then it should fallback to /etc/mime.types 🤔

The specific PR that made the change is golang/go#45271

@francislavoie francislavoie added bug 🐞 Something isn't working upstream ⬆️ Relates to some dependency of this project labels Aug 17, 2021
@francislavoie
Copy link
Member

You may also want to consider asking https://gitlab.freedesktop.org/xdg/shared-mime-info to add that mime type to the database.

@mholt
Copy link
Member

mholt commented Mar 3, 2022

Think I'm going to close this, as it seems that having the MIME db properly installed on the system should resolve the issue; not really a Caddy bug. Thanks!

@mholt mholt closed this as completed Mar 3, 2022
@mholt mholt removed the bug 🐞 Something isn't working label Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream ⬆️ Relates to some dependency of this project
Projects
None yet
Development

No branches or pull requests

3 participants