title: CORS angular js + restEasy on POST
body: <p>I'm doing some <strong>POST</strong> requests from my <strong>angular js</strong> app to my <strong>RESTful API</strong> implemented using <strong>RestEasy</strong>.<br>
  The case is that I need <strong>CORS</strong> so I added a servlet filter with this code:  </p>
  
  <pre><code>public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
      HttpServletResponse response = (HttpServletResponse) res;
      response.addHeader("Access-Control-Allow-Origin", "*");
      response.addHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
      response.addHeader("Access-Control-Max-Age", "3600");
      response.addHeader("Access-Control-Allow-Headers", "Content-Type");
      chain.doFilter(req, res);
  }
  </code></pre>
  
  <p>But I can't figure out why it works only with <strong>GET</strong> requests and not <strong>POST</strong> requests, the error on chrome's console is:  </p>
  
  <blockquote>
    <p>No 'Access-Control-Allow-Origin' header is present on the requested
    resource  </p>
  </blockquote>
  
  <p>My POST request is:  </p>
  
  <pre><code>$http({method: 'POST', 
         url: myUrl,
         data: $scope.data,
         headers: {'Content-Type': 'application/json'}
  });  
  </code></pre>
  
  <p>This is the reponse I receive on POST:</p>
  
  <pre><code>Allow:POST, OPTIONS
  Content-Length:0
  Date:Thu, 03 Apr 2014 23:27:22 GMT
  Server:Apache-Coyote/1.1
  </code></pre>
  
  <p>Any Idea? Thanks!<br>
  <strong>EDIT:</strong><br>
  Tested on IE10 and it works but doesn't work on chrome neither firefox ... any body knows why?</p>