【发布时间】:2021-02-07 03:55:54
【问题描述】:
我有这个简单的 GET 调用,它可以在 Postman、Powershell、C# 甚至浏览器 JS 中完美运行(在禁用 CORS 之后),但是将其移植到 ColdFusion CFHTTP 调用失败。
以下是来自 Jira API 的响应:
{
"ErrorDetail": "I/O Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target",
"Mimetype": "Unable to determine MIME type of file.",
"Filecontent": "Connection Failure",
"Statuscode": "Connection Failure. Status code unavailable.",
"Responseheader": {
},
"Text": true,
"Charset": "",
"Header": ""
}
CF 代码:
<cfset jql="<redacted>">
<cfset jiraEndpoint ='https://jira.bullhorn.com/rest/api/2/search?jql=#jql#'>
<cfhttp url = "#jiraEndpoint#" result="res" method="get" username="<redacted>" password="<redacted>">
<cfhttpparam type="header" name="Accept" value="application/json" />
</cfhttp>
<cfheader name="Content-Type" value="application/json">
<cfoutput>
#serializeJSON(res)#
</cfoutput>
我尝试过的事情:
- 使用了值为
"Basic <base64 encoded string version of username:password>"的授权标头 - 添加了
Content-Type标头 - 添加了
mimetype标头 - 尝试使用a third-party CFC
似乎没有任何效果。
【问题讨论】:
-
这个错误听起来像是证书问题。例如hass.de/content/…
-
我同意这是一个证书问题 - 虽然根据我的经验,除非端点服务器上存在“额外下载”错误配置,否则在 CF2016+ 和 Lucee 5+ 中不应该出现此问题,这在这种情况下没有,所以它看起来更像是由于使用 CF11,OP 不得不为 cfhttp 处理证书的结果。
-
@SevRoberts - 同意。刚刚才注意到CF11标签
标签: coldfusion jira-rest-api coldfusion-11