我正在尝试将文件发布到content.dropboxapi.com
并收到错误Hostname/IP does not match certificate's altnames: Host: example.com. is not in the cert's altnames
,其中example.com是我自己服务器的主机名。我使用的是Node 13.12和Got版本10.2。
当我手动将host
的请求标头更改为content.dropboxapi.com
时,请求有效。此更改有安全隐患吗?
编辑:我的请求代码如下所示:
import { pipeline } from "stream";
import fs from 'fs
import got from "got";
const readStream = fs.createReadstream("hello-world.txt")
const dropboxGot = got.extend({
prefixUrl: "https://content.dropboxapi.com"
responseType: "text",
headers: {
Authorization: "Bearer dfjaiods ... adsfnioa",
"Content-Type": "application/octet-stream",
}
)
const writeStream = dropboxGot.stream.post("2/files/upload", {
"Dropbox-API-Arg": "DROPBOX_ARGS...",
})
pipeline(readStream, writeStream)