title: Interacting with expressjs on another server throwing Access-Control-Allow-Headers errors
body: <p>I am trying to implement Spika web chat ([<a href="http://spikaapp.com/][1]" rel="nofollow">http://spikaapp.com/][1]</a>) on my Amazon server. I have my website code on one server instance and Spika chat server on another server instance. Spika chat server is up and running. Now when I try to interact with the server on my website I get this error :</p>
  
  <pre><code>XMLHttpRequest cannot load http://example.com:8000/spika/v1/user/list/Boom?_=1468157726669.
  Request header field access-token is not allowed by Access-Control-Allow-Headers
  in preflight response.
  </code></pre>
  
  <p>Earlier I had the CORS error I resolved it referring this : <a href="http://enable-cors.org/server_expressjs.html" rel="nofollow">http://enable-cors.org/server_expressjs.html</a></p>
  
  <p>Now I can login but my client but soon after login I get the above error. My current expressjs API handler code for enabling CORS :</p>
  
  <pre><code>    app.use(function(req, res, next) {
          res.setHeader("Access-Control-Allow-Origin", "*");
          res.setHeader("Access-Control-Allow-Credentials", "true");
          res.setHeader("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT");
          res.setHeader("Access-Control-Allow-Headers", "Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers");
          next();
      });
  </code></pre>
  
  <p>Thanks in advance for the help.</p>