devbox icon indicating copy to clipboard operation
devbox copied to clipboard

nginx plugin: Generated config is missing mime.types

Open ThomasLohner opened this issue 3 months ago • 0 comments

What happened?

Nginx will not serve static files (css, js and other) correctly, because there is no mime-types config.

The plugin generates a valid nginx.conf but without mime-types config nginx will return a Content-Type: text/plain header for all static files.

The correct behavior would be to see a header matching the file extension, for example Content-Type: text/css.

To fix this we need to copy https://github.com/nginx/nginx/blob/master/conf/mime.types into the devbox.d/nginx/ folder and add the following to nginx.template

...

http{

include mime.types;

...

Steps to reproduce

  1. run devbox add nginx
  2. add my.css to docroot (devbox.d/nginx/web/)
  3. run curl -I http:/localhost:8081/my.css

You will see the header:

Content-Type: text/plain

Command

No response

devbox.json


Devbox version

ALL

Nix version

No response

What system does this bug occur on?

Other (please include in the description above)

Debug logs

No response

ThomasLohner avatar Sep 04 '25 13:09 ThomasLohner