http-mitm-proxy-brotli

1.0.1 • Public • Published

HTTP MITM Proxy Brotli middleware

http-mitm-proxy-brotli is a middleware that helps decode Brotli requests when working with the wonderful node-http-mitm-proxy package.

Install

npm install --save http-mitm-proxy-brotli

Usage

Simply include it in your onRequest handlers, similar to the built-in Proxy.gunzip response filter.

var Proxy = require('http-mitm-proxy');
var brotliMiddleware = require('http-mitm-proxy-brotli');
var proxy = Proxy();
 
proxy.onError(function(ctx, err) {
  console.error('proxy error:', err);
});
 
proxy.onRequest(function(ctx, callback) {
  if (ctx.clientToProxyRequest.headers.host == 'www.google.com' &&
      ctx.clientToProxyRequest.url.indexOf('/search') == 0) {
    ctx.use(Proxy.gunzip);
    ctx.use(brotliMiddleware);
 
    // Additional code goes here
  }
  return callback();
});
 
proxy.listen({port: 8081});

Package Sidebar

Install

npm i http-mitm-proxy-brotli

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.71 kB

Total Files

4

Last publish

Collaborators

  • pxpeterxu