The example in readme cannot work
I install node-http-mitm-proxy in a node project, paste the example code to file index.js, and run the file. Then I open browser and type www.google.com. But I cannot see log in the terminal.
Yeah, their CA is not generating automatically anymore
Yeah, their CA is not generating automatically anymore
thanks
@CHENGCHANGHU @jasonk @joeferner @NN-Binary I am facing issues in https: . http is working fine. I have pasted code below that i am using and error that i am facing. I can't figure out this . please help me with it. My ultimate requirement is to read https: request and modify it on my node server
my code is ; const port = 8081;
const Proxy = require('http-mitm-proxy').Proxy;
const path = require('path')
const fs = require('fs')
const proxy = new Proxy();
var options = {
keyFile: path.resolve('/projects/testmui-api/.http-mitm-proxy/keys/ca.private.key'),
certFile: path.resolve('/projects/testmui-api/.http-mitm-proxy/certs/ca.pem'),
}
proxy.onError((ctx, err, errorKind) => {
// ctx may be null
console.log(ctx, ' error cert')
const url = ctx?.clientToProxyRequest?.url || "";
console.error(${errorKind} on ${url}:, err);
});
proxy.onCertificateRequired = function(hostname, callback) {
return callback(null, {
keyFile: path.resolve('/projects/testmui-api/.http-mitm-proxy/keys/', hostname + '.key'),
certFile: path.resolve('/projects/testmui-api/.http-mitm-proxy/certs/', hostname + '.pem')
});
};
// proxy.onCertificateRequired = function(hostname, callback) {
// return callback(null, {
// keyFile: path.resolve('/projects/testmui-api/.http-mitm-proxy/keys/', hostname + '.key'),
// certFile: path.resolve('/projects/testmui-api/.http-mitm-proxy/certs/', hostname + '.pem'),
// hosts: ["*.mydomain.com"]
// });
// };
proxy.onCertificateMissing = function(ctx, files, callback) {
console.log('Looking for "%s" certificates', ctx.hostname);
console.log('"%s" missing', ctx.files.keyFile);
console.log('"%s" missing', ctx.files.certFile);
};
proxy.onRequest((ctx, callback) => {
console.log('REQUEST: http://' + ctx.clientToProxyRequest.headers.host + ctx.clientToProxyRequest.url);
return callback();
});
proxy._createHttpsServer(options)
proxy.listen({port})
console.log(listening on ${port});
Error screenshots:
Yeah, their CA is not generating automatically anymore
Any ideas how to fix that?