title: Nodejs HTTPS in Windows server
body: <p>As state in <a href="https://stackoverflow.com/questions/61326944/iis-reverse-proxy-2-subdomain-to-2-node-js">another question</a> in a project used IIS reverse-proxy where in the IIS had a certificated installed and used in two sites where each with a subdomain and with the reverse-proxy point internaly to a port for example localhost:8080 and the other to port localhost:8081.</p>
  
  <p><a href="https://i.stack.imgur.com/GLgTv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GLgTv.png" alt="enter image description here"></a></p>
  
  <p>where had Enabled SSL Offloading selected, it works well.</p>
  
  <p>But have some doubts is there any probleam in question of security if the HTTPS request foward to HTTP but since its internaly seems to me it should be okay?</p>
  
  <p>Second is for the scenario above wouldn't need in Nodejs project to change the </p>
  
  <pre><code>var server = http.createServer(function (req, res) {
  </code></pre>
  
  <p>to </p>
  
  <pre><code>   const options = {
       key: fs.readFileSync('key.pem'),
       cert: fs.readFileSync('cert.pem')
     };
     var server = https.createServer(options, function (req, res) {
  </code></pre>
  
  <p>In this case would start to use the https module and this two files of the certificate key.pem and cert.pem would only need to have this two files or is it needed any more configuration</p>
  
  <p>How would generate this two files from a cer file using the openssl lib or to generate the certificate file to install in IIS if the cer is a OV certificate?</p>
  
  <p>So what would be the best approach install the certificate in iis and use reverse-proxy or in nodejs start using the https module and point to the certificate (key.pem and cert.pem).</p>
  
  <p>-------------------------Edit----------------------------------------------------</p>
  
  <p><a href="https://i.stack.imgur.com/TMp62.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TMp62.png" alt="enter image description here"></a></p>