Node.js 使用节点将HTTP代理到HTTPS
如何使用NodeJS将第三方网站从HTTP代理到HTTPS 例如,我希望我的用户访问Node.js 使用节点将HTTP代理到HTTPS,node.js,http,proxy,http-proxy,Node.js,Http,Proxy,Http Proxy,如何使用NodeJS将第三方网站从HTTP代理到HTTPS 例如,我希望我的用户访问 我已经尝试使用http代理库,在http->HTTPS部分使用了它们的示例,但得到的只是空响应错误。http代理模块应该可以工作。尝试下面的示例,其中代理https://google.com var https = require('https'), httpProxy = require('http-proxy'); // // Create a HTTP Proxy server with a HTTPS
我已经尝试使用http代理库,在http->HTTPS部分使用了它们的示例,但得到的只是空响应错误。
http代理
模块应该可以工作。尝试下面的示例,其中代理https://google.com
var https = require('https'),
httpProxy = require('http-proxy');
//
// Create a HTTP Proxy server with a HTTPS target
//
httpProxy.createProxyServer({
target: 'https://google.com',
agent : https.globalAgent,
secure : false,
headers: {
host: 'google.com'
}
}).listen(8011);
git回购的一个示例是。如果您能分享您的尝试,将非常有帮助。只有这样,我们才能找出问题所在。