title: NodeJS Express reverse proxy TLS_CERT_ALTNAME_INVALID error
body: <p>I have a reverse proxy on my endpoint like this:</p>
  <pre><code>var express = require('express');
  var app = express();
  var httpProxy = require('http-proxy');
  var apiProxy = httpProxy.createProxyServer();
  var serverOne = 'https://idena.navarra.es/ogc/wms?';
  
  app.all('/idena', function (req, res) {
    apiProxy.web(req, res, {target: serverOne});
  });
  
  app.listen(3000, function () {
    console.log('Working!');
  });
  </code></pre>
  <p>When a request to <code>/idena</code> is received, the server throws an exception like this:</p>
  <blockquote>
  <p>Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match
  certificate's altnames: Host: localhost. is not in the cert's
  altnames: DNS:idena.navarra.es, DNS:<a href="http://www.idena.navarra.es" rel="nofollow noreferrer">www.idena.navarra.es</a>
  at Object.checkServerIdentity (tls.js:235:17)
  at TLSSocket.onConnectSecure (_tls_wrap.js:1061:27)
  at TLSSocket.emit (events.js:189:13)
  at TLSSocket._finishInit (_tls_wrap.js:633:8)</p>
  </blockquote>
  <p>How can I solve this? Guess is due to <code>https</code> but no idea of how to avoid that, thanks!</p>