如何通过nodejs中的Web代理使用HTTPS
我可以用HTTP来做到这一点:
var http = require ('http'); http.get ({ host: 'my.proxy.com', port: 8080, path: 'http://nodejs.org/' }, function (response) { console.log (response); });
但是,如果我想要转到HTTPS资源,它不起作用。
我必须使用HTTP连接方法吗? 我将如何构造这个?
谢谢!
你有没有尝试过
var https = require('https');
?
Http通常是端口80,而HTTPS通常是端口443.您是否已经设置服务器响应https端口8080上的请求?