diff --git a/.proxyrc.js b/.proxyrc.js new file mode 100644 index 00000000..b6a52a81 --- /dev/null +++ b/.proxyrc.js @@ -0,0 +1,15 @@ +module.exports = function(app) { + // `app` is an Express instance + app.use(function(req, res, next) { + const sh = res.setHeader; + res.setHeader = function(key, value) { + // remove pointless/incorrect charset from binary responses: + if (/^content-type$/i.test(key)) { + const m = value && value.match(/^(image\/|application\/wasm); charset=.+$/); + if (m) value = m[1]; + } + return sh.call(this, key, value); + } + next(); + }); +};