[英]docker still return self-signed SSL cert error after ignore the TLS unauthorized 0
I am working on a POC for the nodejs container to call another IP's web application for testing.我正在为 nodejs 容器开发 POC,以调用另一个 IP 的 web 应用程序进行测试。 The application working fine in the local development env, and I deployed the app on SUSE15 for the final testing.
该应用程序在本地开发环境中运行良好,我将应用程序部署在 SUSE15 上进行最终测试。 The api would like to call:
api 想拨打:
const httpsAgent = new https.Agent({
rejectUnauthorized: false,
})
axios.defaults.httpsAgent = httpsAgent;
class ansibleService {
public async findJobStatusById(jobId: number){
try{
let res = await axios.get(URL+'/api/v2/jobs/'+jobId ,{headers: {'Authorization': 'Basic '+basicAuth}}, {httpsAgent});
console.log("status code: ", res.status)
console.log(res.data);
return res.data
}catch(err){
console.log(err)
return err
}
The app was built, however, the API call is not working and returns 503 error该应用程序已构建,但是 API 调用不起作用并返回 503 错误
Error: Request failed with status code 503\n at createError (/app/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/app/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:293:11)\n at IncomingMessage.emit (events.js:327:22)\n at endReadableNT (_stream_readable.js:1327:12)\n at processTicksAndRejections (internal/process/task_queues.js:80:21
Coz it just a POC, i am trying to ignore the TLS cert and adding the NODE_TLS_REJECT_UNAUTHORIZED=0
and rejectUnauthorized: false,
in side the code.因为它只是一个 POC,我试图忽略 TLS 证书并在代码中添加
NODE_TLS_REJECT_UNAUTHORIZED=0
和rejectUnauthorized: false,
。
As the result, the app is still returning error 503 with details:结果,该应用程序仍然返回错误 503,其中包含详细信息:
'</head><body id="ERR_SECURE_CONNECT_FAIL">\n' +
'<div id="titles">\n' +
'<h1>ERROR</h1>\n' +
'<h2>The requested URL could not be retrieved</h2>\n' +
'</div>\n' +
'<hr>\n' +
'\n' +
'<div id="content">\n' +
'<p>The following error was encountered while trying to retrieve the URL: <a href="https://10.194.113.123/api/v2/jobs/11507">https://10.194.113.123/api/v2/jobs/11507</a></p>\n' +
'\n' +
'<blockquote id="error">\n' +
'<p><b>Failed to establish a secure connection to 10.194.113.123</b></p>\n' +
'</blockquote>\n' +
'\n' +
'<div id="sysmsg">\n' +
'<p>The system returned:</p>\n' +
'<blockquote id="data">\n' +
'<pre>(71) Protocol error (TLS code: X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT)</pre>\n' +
'<p>Self-signed SSL Certificate: /CN=abc.corpdev.com</p>\n' +
'</blockquote>\n' +
'</div>\n' +
'\n' +
'<p>This proxy and the remote host failed to negotiate a mutually acceptable security settings for handling your request. It is possible that the remote host does not support secure connections, or the proxy is not satisfied with the host security credentials.</p>\n'
Is that any config missed/incorrect on the docker build/run? docker 构建/运行时是否有任何配置遗漏/不正确? Please let me know where am i incorrect for the deployment if have
如果有,请让我知道我在哪里部署不正确
Thanks!!!!谢谢!!!!
You're passing httpsAgent
as an additional argument, but it should be placed in the request config object:您将
httpsAgent
作为附加参数传递,但它应该放在请求配置 object 中:
let res = await axios.get(URL+'/api/v2/jobs/'+jobId, {
headers: {
'Authorization': 'Basic '+basicAuth
},
httpsAgent
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.