Node.js 侦听nodejs中的https流量
我需要监听https流量,我的代码可以监听所有http流量,但无法捕获https。我怎么做? 这是我的密码Node.js 侦听nodejs中的https流量,node.js,https,reverse-proxy,Node.js,Https,Reverse Proxy,我需要监听https流量,我的代码可以监听所有http流量,但无法捕获https。我怎么做? 这是我的密码 var http = require('http'); var url = require('url'); var fs = require('fs'); http.createServer(function(request, response) { var url_part = url.parse(request.url,true); var originUrl = url_part.h
var http = require('http');
var url = require('url');
var fs = require('fs');
http.createServer(function(request, response) {
var url_part = url.parse(request.url,true);
var originUrl = url_part.href;
var options = url.parse(originUrl);
var proxy = http.request(options);
proxy.addListener('response', function (proxy_response) {
proxy_response.addListener('data', function(chunk) {
response.write(chunk, 'binary');
});
proxy_response.addListener('end', function() {
response.end();
});
response.writeHead(proxy_response.statusCode, proxy_response.headers);
});
request.addListener('data', function(chunk) {
proxy.write(chunk, 'application/json');
});
request.addListener('end', function() {
proxy.end();
});
}).listen(3128);
使用
https
模块,请参考文档Hi,我已经使用了https模块。这是我的代码很抱歉,我将其发送到此链接太长了,但当我使用ip连接到代理服务器时,端口会显示ERR_EMPTY_响应如何修复它?我看不到https
模块,您正在使用http
@ArifKhan我已经使用了另一个代码,这是我的代码,请再次查看它有什么问题,您可以同时侦听http和https,但端口不同