当前位置: 动力学知识库 > 问答 > 编程问答 >

node.js - Solving Nodejs https.request self-signed certificate error in production

问题描述:

I am using Nodejs/Express along with nginx. I am trying to make https.request from an Express route which results in self signed certificate error. I have resolved the error in development mode using:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"

which worked perfectly. I will be deploying my application on CentOS. My question is how to avoid the same error in production mode. Nginx is being used on CentOS too. I tried creating the certificate on CentOS based on How To Create a SSL Certificate on nginx for CentOS 6

But, that doesn't solve the purpose as the Node application can be running on any CentOS VM and I don't want to perform these steps for each virtual machine. Is there anything which I can do from the application side to avoid this error in production?

Some of the similar questions that I already went through on StackOverflow are:

  • create a trusted self-signed SSL cert for localhost (for use with Express/Node)
  • How do I use a self signed certificate for a HTTPS Node.js server?
  • How can I create a self-signed cert for localhost?

分享给朋友:
您可能感兴趣的文章:
随机阅读: