title: CORS Problem when using two express application
body: <p>I'm trying to use two Node.js express servers on a Windows Server 2012, each one with a different FQDN (example1.b.br | exemple2.b.br). 
  The applications are two Watson Chatbots, so both of them need to use route /conversation to communicate with IBM.</p>
  
  <p>One chatbot uses port 443 and the other one use 8443.</p>
  
  <p>The problem is: Each one of them are in different directories and have their own subdirectory called 'public', but when I execute both servers, the one using port 8443 uses the port 443 server's 'public' subdirectory.</p>
  
  <ul>
  <li><p>Chatbots</p>
  
  <ul>
  <li>certificates</li>
  <li><p>Chatbot1</p>
  
  <ul>
  <li><p>node_modules</p></li>
  <li><p>public </p></li>
  <li>css</li>
  <li>script</li>
  </ul></li>
  <li>Chatbot2 
  
  <ul>
  <li>node_modules</li>
  <li>public</li>
  <li>css</li>
  <li>script</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>Chatbot1 app.js:</p>
  
  <pre><code>const AssistantV1 = require('watson-developer-cloud/assistant/v1');
  const express = require('express');
  const bodyParser = require('body-parser');
  const http = require('http');
  const https = require('https');
  var fs = require('fs');
  var httpApp = express();
  
  var workspace;
  
  var options = {
    key: fs.readFileSync('certificates/key.pem'),
    cert: fs.readFileSync('certificates/server.crt')
  };
  
  const app = express();
  
  app.use(bodyParser.json());
  app.use(express.static('./public'));
  
  const port = 80;
  const httpsPort = 8443;
  
  httpApp.set('port', process.env.PORT || 80);
  
  const assistant = new AssistantV1({
    username: 'XXXXX',
    password: 'XXXXX',
    url: 'https://gateway.watsonplatform.net/assistant/api/',
    version: '2018-02-16'
  });
  
    workspace = 'XXXXXXX';
    app.post('/conversation/', (req, res) =&gt; {
      const { text, context = {} } = req.body;
      const params = {
        input: { text },
        workspace_id: workspace,
        context,
      };
  
      assistant.message(params, (err, response) =&gt; {
        if (err) res.status(500).json(err);
  
        res.json(response);
      });
    });
  
  try{
    //var httpServer = http.createServer(httpApp, app).listen(port);
    var httpsServer = https.createServer(options, app).listen(httpsPort); 
    //httpServer.listen(port, () =&gt; console.log(`Running on port ${port}`));
    httpsServer.listen(httpsPort, 'exemple1.b.br', () =&gt; console.log(`HTTPS Running on port ${httpsPort}`));  
    console.log(`---------------------------------`);
    console.log(`-----------ROBO INICIADO---------`);
    console.log(`---------------------------------`);
  }catch(err){
    console.log(`*********************************`);
    console.log(`*****Falha ao iniciar o Robo*****`);
    console.log(`*********************************`);
    console.log(err);
  } */
  </code></pre>
  
  <p>Chatbot2 app.js:</p>
  
  <pre><code>const AssistantV1 = require('watson-developer-cloud/assistant/v1');
  const express = require('express');
  const bodyParser = require('body-parser');
  const http = require('http');
  const https = require('https');
  var fs = require('fs');
  var httpApp = express();
  
  var workspace;
  
  var options = {
    key: fs.readFileSync('certificates/key.pem'),
    cert: fs.readFileSync('certificates/server.crt')
  };
  
  const app = express();
  
  app.use(bodyParser.json());
  app.use(express.static('./public'));
  
  const port = 80;
  const httpsPort = 443;
  
  httpApp.set('port', process.env.PORT || 80);
  
  const assistant = new AssistantV1({
    username: 'xxxxxxx',
    password: 'xxxxxx',
    url: 'https://gateway.watsonplatform.net/assistant/api/',
    version: '2018-02-16'
  });
  
    workspace = 'XXXXXXX'
    app.post('/conversation/', (req, res) =&gt; {
      const { text, context = {} } = req.body;
      const params = {
        input: { text },
        workspace_id: workspace,
        context,
      };
  
      assistant.message(params, (err, response) =&gt; {
        if (err) res.status(500).json(err);
  
        res.json(response);
      });
    });
  
  
  try{
    var httpsServer = https.createServer(options, app).listen(httpsPort); 
     httpsServer.listen(httpsPort, 'exemple2.b.br', () =&gt; console.log(`HTTPS Running on port ${httpsPort}`));  
    console.log(`---------------------------------`);
    console.log(`-----------ROBO INICIADO---------`);
    console.log(`---------------------------------`);
  }catch(err){
    console.log(`*********************************`);
    console.log(`*****Falha ao iniciar o Robo*****`);
    console.log(`*********************************`);
  }
  </code></pre>
  
  <p>How can I "force" the server to use its own subdirectory?</p>