nodejs通过代理发送https请求时出错
发布于 9 年前 作者 zone21 4020 次浏览 最后一次编辑是 8 年前 来自 问答

服务器放置于内网,前面有一层代理 在这种情况下使用https请求, 代理是用Squid, 请求返回了最下面的错误, 有木有高手提供解决方法 代码如下: var info=parse(url); var options = { hostname: info.hostname, port: info.port, path: info.path, method: ‘GET’ }; var req = http.request(options, function (res) { res.on(‘data’, function (chunk) { // console.log('BODY: ’ + chunk); callback(null,chunk);//返回结果 }); }); req.on(‘error’, function (e) { console.log('problem with request: ’ + e.message); callback(e,null); }); req.end();

错误返回: ERROR The requested URL could not be retrieved

While trying to retrieve the URL: https://api.weixin.qq.com/cgi -bin/token?

The following error was encountered:

Unsupported Request Method and Protocol 

Squid does not support all request methods for all access protocols. For example, you can not POST a Gopher request.

Your cache administrator is webmaster. Generated Thu, 16 Jul 2015 09:40:41 GMT by holycat_proxy (squid/2.6.STABLE22)

回到顶部