title: $http post return 400 on google chrome angularjs
body: <p>well I have this issue when I use $http.post of angularjs on google chrome it always returned with <strong>error 400</strong> which is <strong>bad request</strong>, however when I tried on Mozilla Firefox it works fine!</p>
  
  <p>this is the $http services code</p>
  
  <pre><code>$http({
         'method': "POST",
         'url': "http://example.com",
         'data': data,
         'withCredentials': true,
         'cache': false,
         headers: {
                   'Content-type': 'application/json',
                   'authTokens': sessionServices.get('userLogin').userLoginTokens,
                   'JSESSIONID': sessionServices.get('JSESSIONID')
                   }
         }).
         success(function(data, response, headers, status) {
                                console.log("sucess");     
                                  }).
         error(function(data, response) {
                                console.log("failed");
                                  });
  </code></pre>
  
  <p>this is the example data intput on the $http request it self</p>
  
  <pre><code>data = [123415, 32324123, 1123124123, 1213123]
  </code></pre>
  
  <p><strong>NOTE*</strong> </p>
  
  <ul>
  <li><p>the url that I submitted to which is the backend is in another domain so for example I deployed the application on <a href="http://example1.com" rel="nofollow">http://example1.com</a> while the backend is on <a href="http://example.com" rel="nofollow">http://example.com</a>, at first I thought it was CORS issue but then apparently I passed the OPTION call and when moved to the second call which is the POST request it self then it returned with the error 400</p></li>
  <li><p>apparently the chrome ignores my custom headers option set which is 'application/json', but in chrome it returned differently. you could see the returned call below</p></li>
  </ul>
  
  <p>Remote Address:example1.com
      Request URL:example.com
      Request Method:POST
      Status Code:400 Bad Request</p>
  
  <pre><code>Request Headers
  view source
  Accept:application/json, text/plain, */*
  Accept-Encoding:gzip,deflate
  Accept-Language:en-US,en;q=0.8,id;q=0.6,ms;q=0.4
  authTokens:13f4ca0d-eb30-435b-b313-a78ed8fff5ef
  Connection:keep-alive
  Content-Length:313
  Content-Type:application/json;charset=UTF-8 application/json
  Cookie:JSESSIONID=F524FAFC1178EE3451A7D82CBAD9BE87
  Host:http://example1.com
  JSESSIONID:F524FAFC1178EE3451A7D82CBAD9BE87
  Origin:http://example.com
  Referer:http://example.com
  User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
  X-Requested-With:XMLHttpRequest
  
  Request Payload
  view source
  [d6fece6d-fd4b-4377-b326-7e7cdafbe02b, 6240a840-29a7-4e16-899a-2db0fde6ffdd,…]
  0: "d6fece6d-fd4b-4377-b326-7e7cdafbe02b"
  1: "6240a840-29a7-4e16-899a-2db0fde6ffdd"
  2: "794ae064-38f3-4324-8cda-5afaabe2347d"
  3: "41d28490-624d-418d-8fda-4a0ed8c65aa2"
  4: "38e06d09-1d33-42d2-b6a2-e06548743a1a"
  5: "7f8e92c8-4217-443a-9830-3da78a75b1a6"
  6: "ed31b19a-2b2a-4fd7-99b8-b5b61d6a881f"
  7: "2b1b8636-d342-4114-9de3-40d42003790f"
  
  Response Headers
  view source
  Access-Control-Allow-Credentials:true
  Access-Control-Allow-Origin:example1.com
  Access-Control-Expose-Headers:Jsessionid
  Connection:close
  Content-Language:en
  Content-Length:990
  Content-Type:text/html;charset=utf-8
  Date:Wed, 15 Oct 2014 15:25:48 GMT
  Server:Apache-Coyote/1.1
  Vary:Origin
  </code></pre>
  
  <p>do you have this issue as well ?? could you guys help me ??</p>