title: Self signed certificate: I am missing the relation between browser and server
body: <p>I created a Self Signed certificate using openSSL using this command:</p>
  
  <pre><code>openssl req -x509 -out localhost.crt -keyout localhost.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config &lt;( \
  printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
  </code></pre>
  
  <p>I have a Express/Node server using it through this code:</p>
  
  <pre><code>https
      .createServer(
        {
          key: fs.readFileSync("/Users/Me/.localhost-ssl/localhost.key"),
          cert: fs.readFileSync("/Users/Me/.localhost-ssl/localhost.crt")
        },
        app
      )
      .listen(8080, () =&gt; console.log(env + " Server listening on port 8080"));
  </code></pre>
  
  <p>I started this server and it's running through https. I have a client (based on create-react-app) running in the same machine, different port, trying to connect to this server on port 8080.</p>
  
  <p>On the first run, I trusted the certificate after Chrome said that it was invalid and, as the picture below shows, my client app does not complain about the certificate:</p>
  
  <p><a href="https://i.stack.imgur.com/DsAZU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DsAZU.png" alt="Connections is safe"></a></p>
  
  <p>However, the client can't retrieve data from the server. The client shows this error:
  <a href="https://i.stack.imgur.com/PoiU0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PoiU0.png" alt="enter image description here"></a></p>
  
  <p>Here my keychain picture, showing this certificate:</p>
  
  <p><a href="https://i.stack.imgur.com/XId3X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XId3X.png" alt="enter image description here"></a></p>
  
  <p>What is missing? Do I need 2 certificates in my keychain? Because I am running the client and the server in the same machine.</p>