-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
http: support serving wasm by StaticFileHandler #6377
http: support serving wasm by StaticFileHandler #6377
Conversation
This is import to serve wasm file. Browsers don't run wasm without correct 'Content-Type'.
I'm not sure about extending the default MIME type list with such lesser used types. This is just adding a random type. There are hundreds of MIME types a webserver needs to know about. There are many much more important than The trouble is, if we include a considerably sized database by default, people will expect it to be comprehensive. And I don't think the Crystal developers should be bothered with maintaining this. That's typically the system or application administrator's job. If we just provide a minimal default set, it is clear that this is not meant for anything useful and you need to use a proper MIME database. With #5765 this is going to be much easier and typically don't require any configuration whatsoever. The existing defaults are really just a bare minimum to get at least "something" going, but can't honestly provide anything useful. |
@straight-shoota You thought the importance of wasm on Web is tooo little. It is the standard ranked with JavaScript in near future. And other important point is, repeatedly, browser does not accept wasm file without correct Content-Type. This experience is so bad. What do you thikn if the image served by your server is not shown in browser? |
Come on, it's just one line, it doesn't hurt anyone :-) |
@makenowjust I know the current state is not satisfactory. That's why I did #5765. That's actually the better solution to your problem. Let's wait for it to get merged, and there shouldn't be any issues with missing MIME types (or it's easy to fix with |
@asterite it'll be 2000 lines if we allow crystal to maintain it's own complete mime registry. The fact is that wasm isn't that common a mime type. It's even too new to be in my |
It is true #5765 is better of course 😄 I don't hope crystal to maintain the entire mime db. It is too large. I think so too. I hope only to add just one line. In other words, wasm mime type should be contained in the smallest fallback mime db of crystal. I feel it is valuable because I'm sure wasm becomes the important Web standard and it can prevent the worst experience: wasm is not ran due to no mime type. In fact Go's standard library contains wasm mime type. To be honest I'm embarrassed to need to use the server written Go to develop wasm 😢 |
Here's the thing, which happens a lot in this project: we have a simple fix that can improve a developer's life. Then we have a monolith that's a super good, flexible alternative, but it's being discussed, it's in review, etc. People in this community prefer to not add a single line now, which will be gone anyway later, and instead stay with a poor solution until the really good one comes. I'm seeing this a lot lately, unfortunately. |
This is import to serve wasm file. Browsers don't run wasm without correct 'Content-Type'.
@straight-shoota Can you add
wasm
mime type to #5765 when this is merged?