title: When sending a POST request to an external server, Node is giving me a "self signed certificate in certificate chain" error
body: <p>I'm using axios to send a POST request to an external server with some data.  Here's my axios setup, without any extras to handle the self-signed cert: </p>
  
  <pre><code>const https = require('https')
  const axiosConfig = {
    method: 'post',
    data: callbackXML,
    url: process.env.CALLBACK_URL,
    headers: responseHeaders
  }
  
  await axios.request(axiosConfig).then((response) =&gt; {
    console.log('resp is', response)
  })
    .catch(e =&gt; {
      console.log(`${helpers.getLoggingTimestamp()} error is`)
      console.log(e.toJSON())
    })
  </code></pre>
  
  <p>I know there is a solution to use locally, because I am using it already, which is </p>
  
  <pre><code>NODE_TLS_REJECT_UNAUTHORIZED='0'
  </code></pre>
  
  <p>However, for obvious reasons, that's not something that's acceptable in a production environment.  </p>
  
  <p>I've tried just about everything involving the topic here on SO, Googling, etc.  I've tried adding certs to <code>NODE_EXTRA_CA_CERTS</code> via env variables, as well as setting the <code>ca:</code> option in an <code>https Agent</code> and passing that into an axios config.  I've also tried adding the certs via the command line, like so: <code>export NODE_EXTRA_CA_CERTS=/c/code/server.crt</code>.</p>
  
  <p><strong>My real question is, where is my offending cert located?  If I'm not adding the offending self signed cert, then I will never solve this.</strong> </p>
  
  <p>Side note: this is a node problem, not an axios problem, as I've tried out other request libraries and I get the same error. </p>