Skip to content

nginx plugin: Generated config is missing mime.types #2693

@ThomasLohner

Description

@ThomasLohner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions