Unit: MIME module or other solution for static? Inquiry

Created on 22 Mar 2019  ·  4Comments  ·  Source: nginx/unit

This is more of a general question than an actual issue. Sorry. I wasn't sure where else to put it.

nginx unit, unlike nginx, has no concept of MIME. Most frameworks kick back text/html and it happily serves as text/html. I was hoping to get a general idea of where unit might go with something like this.

Will there be a MIME module in the future?
Is that unlikely in order to keep unit a "pure" application server?
Will we be able to "chain" applications or routes at some point (ie: like try_files)?

Any of the above is :+1: to me. I know the "right answer" is nginx and/or a CDN, but I really wanted to ask about how this might work in the future so I don't end up going down an unnecessary path based on my own assumptions. :)

question

Most helpful comment

Sure, it includes setting correct Content-Type and the simplest way is to determine it from file name extension (like nginx does). I think Unit should have a predefined list with common MIME types (like mime.types in nginx) and users should be able to redefine existing or add additional types via our control API.

Is that unlikely in order to keep unit a "pure" application server?

There's no goal to keep it as just an application server. Running web application processes by Unit is just an initial feature it has got.

But I'm also wondering whether both the features static & proxying will be supported in UNIT 1.9?

Adding proxy support from the current perspective requires more code than serving static files. So, it's highly likely that static files feature will appear sooner than proxy. And in fact, proxy is much bigger feature (if you consider load balancing, TLS support, etc...).

All 4 comments

@tamarintech

Take a look.
https://www.nginx.com/blog/nginx-unit-1-8-0-now-available/

When they’re done, NGINX Unit will be able to receive an HTTP request and do one of the following: process it internally with an app in any of the supported languages, deliver a static file from the filesystem, or proxy the request further to another NGINX Unit instance or a different backend.

But I'm also wondering whether both the features static & proxying will be supported in UNIT 1.9?
@VBart

Right. I'm familiar with that section which is part of what really peaked my interest. nginx leverages MIME to send the right content type where there simply isn't anything like that in unit. Would "deliver static content from the filesystem" include MIME typing like nginx proper does via config? Would that be a separate MIME or static module with unit configuration?

The text doesn't quite indicate if the functionality of process, deliver static, or proxy would function like try_files or if it's intended to make routes matching /static/*.html or how we would get MIME.

I'm more curious than anything.

Sure, it includes setting correct Content-Type and the simplest way is to determine it from file name extension (like nginx does). I think Unit should have a predefined list with common MIME types (like mime.types in nginx) and users should be able to redefine existing or add additional types via our control API.

Is that unlikely in order to keep unit a "pure" application server?

There's no goal to keep it as just an application server. Running web application processes by Unit is just an initial feature it has got.

But I'm also wondering whether both the features static & proxying will be supported in UNIT 1.9?

Adding proxy support from the current perspective requires more code than serving static files. So, it's highly likely that static files feature will appear sooner than proxy. And in fact, proxy is much bigger feature (if you consider load balancing, TLS support, etc...).

Thanks for the insights! I'm going to close this so it doesn't clutter. :+1:

Was this page helpful?
0 / 5 - 0 ratings