title: SailsJS - CORS - The 'Access-Control-Allow-Origin' header contains the invalid value ''
body: <p>I generated a new <a href="http://sailsjs.com/get-started" rel="nofollow noreferrer">sails.js</a> app and created a test API as follows.</p>
  
  <pre><code>module.exports = {
       test:function (req, res) {
          return res.ok({success: true});
      },
  }
  </code></pre>
  
  <p>The <code>sails</code> app is hosted in a standalone local machine with at <code>192.168.3.208:1337</code>.</p>
  
  <p>My <code>CORS</code> config is as follows.</p>
  
  <pre><code>module.exports.cors = {
    origin: '*',
    credentials: true,
  };
  </code></pre>
  
  <p>When I make a simple <code>AJAX</code> call from my local machine (<code>192.168.3.210</code>) to the API,</p>
  
  <pre><code>$.ajax({
      type: 'GET',
      url: 'http://192.168.3.208:1337/api/test',
      dataType: 'json',
      success: function(data) {
          console.log(data);
      },
      failure: function(data) {
          console.log(data);
      }
  });
  </code></pre>
  
  <p>I get the following error</p>
  
  <blockquote>
    <p>Failed to load <a href="http://192.168.3.208:1337/api/test" rel="nofollow noreferrer">http://192.168.3.208:1337/api/test</a>: The
    'Access-Control-Allow-Origin' header contains the invalid value ''.
    Origin '<a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>' is therefore not allowed access.</p>
  </blockquote>
  
  <p>The html page is hosted with Apache at port 80.</p>
  
  <p>What am I missing here?</p>