How to set value for NODE_TLS_REJECT_UNAUTHORIZED
nodejsTo set the value of the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’, you can use one of the following methods:
- On the command line: You can set the value of the environment variable when starting your Node.js program using the following syntax:
NODE_TLS_REJECT_UNAUTHORIZED=0 node your-program.js
- In a configuration file: You can create a configuration file (e.g. .env) that sets the value of the environment variable, and then use a tool like dotenv to load the configuration file when starting your Node.js program. For example:
// .env file
NODE_TLS_REJECT_UNAUTHORIZED=0
// In your program
require('dotenv').config()
- In the operating system: You can set the value of the environment variable permanently in the operating system’s environment variable configuration. The specific steps to do this will depend on the operating system you are using.
Keep in mind that setting the value of NODE_TLS_REJECT_UNAUTHORIZED to ‘0’ disables certificate verification for TLS connections and HTTPS requests, which can make them insecure. It is generally not recommended to disable certificate verification, unless you have a specific reason to do so and understand the risks involved.
Other Article on Tag nodejs
- - axios Request path contains unescaped characters
- - CryptoJS.HmacSHA256 Cannot read properties of undefined (reading 'sigBytes')
- - encrypt by java and decrypt by node
- - fetch function mode sors, no-cors, same-origin
- - How to set value for NODE_TLS_REJECT_UNAUTHORIZED
- - it error Request path contains unescaped characters
- - java vs nodejs
- - nodejs add redis
- - nodejs call api get request
- - nodejs connect mysql database