Hi,
I have use case where I'm proxying to a server w/ require mutal tls? If so is there any documentation of that?
Regards,
Dat
After digging through the code I finally got POC that worked, hopefully this can help someone else.
var http = require('http'), httpProxy = require('http-proxy'); fs = require('fs');
var https = require('https');
var options = {
pfx: fs.readFileSync('clientCert.pfx'),
passphrase: 'password',
rejectUnauthorized: false
};
options.agent = new https.Agent(options);
var proxyConfig = {
target: 'https://localhost:8080/',
agent: options.agent
};
proxyConfig = Object.assign(proxyConfig,options);
var proxy = httpProxy.createProxyServer(proxyConfig);
var server = http.createServer(function(req, res) {
proxy.web(req, res);
});
server.listen(5050);
Hi there! Your snippet helped me in finding a solution to a similar problem.
I also made a Pull Request #1209, adding an example to the official use cases in order to help other people in the future.
Most helpful comment
After digging through the code I finally got POC that worked, hopefully this can help someone else.