Wrong MIME types from Meteor server (for e.g. .wasm)

I feel like the content-type that is being returned from the Meteor server is (sometimes) wrong and I don’t know how to fix it. When I have a .wasm file in the public folder and use e.g. curl -I, it shows content-type as octet-stream, which seems to be the default. This is happening when I run a bare meteor localhost app.

I tried to set up own NGINX in front of Meteor but that seems to have no effect (I read somewhere that proxy-passed requests will keep destination’s content-type which would explain why my nginx config got ignored). Zodern’s MUP proxy produces the same results, from which I assume I have it configured correctly.

I also tried to intercept the request in the server code using
WebApp.connectHandlers.use('/', but that is only catching e.g. .js files in the public folder but not eg the .wasm files.

I don’t know what’s wrong and how can I fix this. This whole thing seems to be non-existent in the documentation. I don’t even know what is returning all the (browser) http requests. What webserver is there and it can be configured?

Thank you

While I accidentaly found the solution (when looking for something else), in the webfont loading topic at https://guide.meteor.com/deployment.html, I still don’t have the whole picture. Maybe this should be configurable? Or at least the documentation should be clearer that this is the way to “update” MIME types? I can create a PR to update the documentation (somewhere).

WebApp.rawConnectHandlers.use(function(req, res, next) {
  if (req._parsedUrl.pathname.match(/\.(wasm)$/)) {
    res.setHeader('Content-Type', 'application/wasm')
1 Like