Azure 函数请求中端口 443 上的 EACCESS 错误

EACCESS error on port 443 within Azure Function request

我正在向服务器发出 https 请求,这需要 TLS 1.2。

向该服务器发出 GET 请求可以在我的浏览器中使用 CURL,但在我的 Azure 函数中出现此错误:

Error: connect EACCES 127.0.0.1:443
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
code: 'EACCES',
errno: 'EACCES',
syscall: 'connect',
address: '127.0.0.1',
port: 443

此请求是在 azure 函数中完成的。我的 azure 函数没有自定义域,因此它应该使用他们的 SSL 否?我错过了什么?

这是我的要求:

var options = {
        url: 'https://somesite.ca/somepath/Services/something.asmx/GetTrustedAutorizationTicket',
        qs: {UserName: 'username', Domain: '', Password: 'pwd', ClearText: 'true'},
        headers: {
            'Content-Type': 'text/xml',
        }
    }

    var req = https.get(options, function(res) {...

TIA

options 中没有 url。您正在寻找 hostnamepath.

例如

const https = require('https');

const options = {
  hostname: 'somesite.ca',
  port: 443,
  path: '/somepath/Services/something.asmx/GetTrustedAutorizationTicket',
  method: 'GET'
};

const req = https.request(options, (res) => {
  console.log('statusCode:', res.statusCode);
  console.log('headers:', res.headers);
  ...

参考:https://nodejs.org/api/https.html#https_https_request_options_callback