- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
尝试使用 HTTPS 向网站发送请求时,我收到以下错误:ERR_TLS_CERT_ALTNAME_INVALID
我尝试将 insecure: true
添加到我的请求负载中,但这没有任何作用,我也尝试添加 rejectUnauthorized: false
但这给了我一个 400 错误 - 错误的请求。
var rp = require('request-promise').defaults({jar: true});
var sess = rp.jar();
function SendRequest() {
let link = "https://www.example.com";
payload = {
method: 'GET',
jar: sess,
json: true,
url: link,
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8',
'Connection': 'keep-alive',
'Host': link,
'Upgrade-Insecure-Requests': '1', // removed this nothing changed
'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Mobile Safari/537.36'
},
gzip: true
// tried adding insecure: true (did nothing) & rejectUnauthorized: false (returned 400 error)
}
rp(payload)
.then(function(json) {
console.log(json)
})
}
我希望请求能够顺利通过。
最佳答案
事实证明,400 错误实际上与 header 'Host': link,
相关,删除此 header 并添加 rejectUnauthorized: false
后一切正常。
关于node.js - NodeJS 请求 promise ERR_TLS_CERT_ALTNAME_INVALID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54355341/
我将 nodemailer 配置为发送到 hostgator(因为我在这里学到了如何:https://stackoverflow.com/a/56291143/954986): const trans
我尝试将webpack-dev-server用作对远程测试服务器的API请求的代理(以免在本地计算机上引发繁重的Java服务器)。问题是远程服务器仅使用HTTPS。由于某种原因,尽管它可以从浏览器中正
我已经有一段时间没有尝试设置一个新的 Angular 应用程序了——因为我已经在一个现有的应用程序上工作了几个月。 今天,在我的 Mac 中尝试通过终端安装一个新的 Angular 应用程序时,它运行
尝试使用 HTTPS 向网站发送请求时,我收到以下错误:ERR_TLS_CERT_ALTNAME_INVALID 我尝试将 insecure: true 添加到我的请求负载中,但这没有任何作用,我也尝
我在 Windows (Ubuntu 18) 上运行 bash,最近切换到 Yarn,但我需要再次使用 npm 来安装 truffle,然后发现我的 npm 已经死了。我尝试重新安装 node/npm
我是一名优秀的程序员,十分优秀!