fix(nginx plugin): include mime.types so static files get correct Content-Type#2844
Merged
Conversation
…tent-Type The nginx plugin generated an nginx.conf without a `mime.types` include, so nginx served every static file (css, js, images, etc.) with `Content-Type: text/plain`. This adds a standard `mime.types` file to the plugin's virtenv and includes it from the generated config. The file is placed in the virtenv (the nginx `-p` prefix dir), so the existing relative-path convention used for `error.log`, `access.log` and the `temp/*` paths applies to the `include mime.types;` directive as well. Fixes #2693
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect Content-Type headers for static assets served by the built-in nginx plugin by ensuring nginx loads a mime.types map at runtime (addressing #2693). It aligns the generated plugin config and the checked-in nginx example so that CSS/JS/images/fonts are served with the correct MIME type.
Changes:
- Add
plugins/nginx/mime.typesand ensure it’s created into the plugin virtenv viacreate_files. - Include
mime.typesin the generatedhttp { ... }block in both the template and the checked-in default config. - Bump the nginx plugin version to
0.0.5and update the nginx example configs accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/nginx/nginx.template | Adds include mime.types; in the http block so envsubst-generated configs load MIME mappings. |
| plugins/nginx/nginx.conf | Adds include mime.types; to the default checked-in config copied to devbox.d/nginx. |
| plugins/nginx/mime.types | New MIME type mapping file to be included by nginx at runtime. |
| plugins/nginx.json | Bumps plugin version and ensures mime.types is created under {{ .Virtenv }}. |
| examples/servers/nginx/devbox.d/nginx/nginx.template | Keeps the example template consistent by including mime.types. |
| examples/servers/nginx/devbox.d/nginx/nginx.conf | Keeps the example generated config consistent by including mime.types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gcurtis
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2693.
The
nginxplugin generated annginx.confthat did not include amime.typesmap. As a result, nginx fell back to its default type and served every static file (CSS, JS, images, fonts, …) withContent-Type: text/plain, so browsers wouldn't apply stylesheets or run scripts.What changed
mime.typesfile to the plugin (plugins/nginx/mime.types).create_files({{ .Virtenv }}/mime.types).include mime.types;to the generatedhttp { … }block in bothnginx.templateandnginx.conf.0.0.4→0.0.5.examples/servers/nginxconfig to stay consistent.Why the virtenv (and a relative include)
The plugin launches nginx with
nginx -p $NGINX_PATH_PREFIX …, whereNGINX_PATH_PREFIXis the plugin's virtenv. nginx resolves relative paths against that prefix — which is exactly how the existingerror_log error.log,access_log access.log, andtemp/*paths already work. Placingmime.typesin the virtenv and using a plaininclude mime.types;keeps the fix consistent with that convention and requires no new env var. The virtenv copy is also regenerated on every run, so it stays in sync with the plugin.How to verify
Testing
go build ./...passes.TestGitPluginFileContentCache*tests that fail only because they make local git commits (commit signing is unavailable in this CI sandbox) — unrelated to this change.cc @ThomasLohner (issue reporter) — thanks for the clear repro!
Generated by Claude Code