Opened 2 years ago

Last modified 8 months ago

#1606 new enhancement

WebAssembly doesn't work on Firefox/Chrome due to missing MIME type

Reported by: DesWurstes@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.15.x
Keywords: mime mime.types Cc:
uname -a:
nginx -V: nginx version: nginx/1.15.2

Description

WebAssembly's MIME type is application/wasm. If not set; Firefox, Chrome and Vivaldi won't be able to run the WASM.

Here's the Chrome error message:

util.js:1632 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

Could you please add application/wasm wasm to nginx/conf/mime.types?

Change History (4)

comment:1 by Maxim Dounin, 2 years ago

Keywords: mime mime.types added
Priority: majorminor
Type: defectenhancement

Thanks for your suggestion. Note that if you want to add additional types or serve some files with specific custom types, you can do so using the types directive, see the documentation for examples.

Some related facts as found during a quick investigation, just for the record:

Note that we generally only add most popular types to the mime.types as shipped with nginx. It is not currently clear if application/wasm is one of such types, so leaving this open for now. If you are reading this and also want (or don't want) application/wasm to be added, please comment.

comment:2 by dbrgn@…, 16 months ago

If you are reading this and also want (or don't want) application/wasm to be added, please comment.

I signed up here to say: Yes, I'd also like to see this type added! :)

The the WebAssembly specification isn't yet complete, though there is a ​public draft.

It's true that the spec isn't complete, but in the meantime the WebAssembly MVP (https://webassembly.org/docs/mvp/) has shipped across all major browsers (at least Firefox, Chrome, Edge, Safari).

Oh, and it seems that the mime type has been added to cpython as well.

comment:3 by ccouzens@…, 8 months ago

If you are reading this and also want (or don't want) application/wasm to be added, please comment.

Yes please, I would like to see this added. I have a patch, although it isn't exactly a complicated change.

The WebAssembly specification isn't yet complete, though there is a public draft.

It's now a "Proposed Recommendation", which is the final step to becoming a W3C recommendation (although they stress until it's a recommendation it's still a draft).

I think on balance it's reasonable for nginx to hold off until it's a W3C recommendation. I imagine it's easier for the nginx project to add it once it has become a recommendation, than to remove it should it fail.

comment:4 by ccouzens@…, 8 months ago

The WebAssembly? specification isn't yet complete, though there is a ​public draft.

It's now a W3C recommendation. I think this happened today.
And it says that it should be served with the mime type application/wasm

https://www.w3.org/TR/wasm-web-api-1/#streaming-modules

Note: See TracTickets for help on using tickets.