Spaces:
Runtime error
Runtime error
Create disableCompression.js
Browse files- disableCompression.js +22 -0
disableCompression.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* n8n custom extension – remove Express `compression()` middleware
|
| 3 |
+
* plus safeguard: strip any Content-Encoding header that sneaks in.
|
| 4 |
+
*/
|
| 5 |
+
module.exports = {
|
| 6 |
+
init(app) {
|
| 7 |
+
// compression() की layer identify करके router से हटा दें
|
| 8 |
+
if (app?._router?.stack) {
|
| 9 |
+
app._router.stack = app._router.stack.filter(
|
| 10 |
+
(layer) => !(layer.handle && layer.handle.name === 'compression')
|
| 11 |
+
);
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
// fallback middleware – हर response पर header उड़ा दो
|
| 15 |
+
app.use((_req, res, next) => {
|
| 16 |
+
res.removeHeader('Content-Encoding');
|
| 17 |
+
next();
|
| 18 |
+
});
|
| 19 |
+
|
| 20 |
+
console.log('🗜️ gzip disabled via custom extension');
|
| 21 |
+
},
|
| 22 |
+
};
|