title: CORS error in AngularJS
body: <p>When I am using Fiddler or any browser side HTTP client extension like Advanced Rest Client, I can get data from a API easily. 
  But when I try to use the same API from Angular JS, CORS issue appear immediately. I have tried with following lines to solve the problem in AngularJS, But unfortunately it did not work.  </p>
  
  <pre><code>appd.config(function ($httpProvider) {
    //  $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
      // $httpProvider.defaults.headers.post['Accept'] = '*/*'
      $httpProvider.defaults.useXDomain = true;
      $httpProvider.defaults.withCredentials = true;
      delete $httpProvider.defaults.headers.common["X-Requested-With"];
      $httpProvider.defaults.headers.common["Accept"] = "*/*";
      $httpProvider.defaults.headers.common["Content-Type"] = "application/x-www-form-urlencoded";
      $httpProvider.defaults.headers.common['Authorization'] = 'Basic encodedpassword=';
  }); 
  </code></pre>
  
  <p>I get following error in mozilla: </p>
  
  <p>Cross-Origin Request Blocked: </p>
  
  <pre><code>The Same Origin Policy disallows reading the remote resource at http://host/training_webapi. This can be fixed by moving the resource to the same domain or enabling CORS.
  </code></pre>
  
  <p>And following in Chrome: </p>
  
  <pre><code> XMLHttpRequest cannot load http://host/training_webapi The request was redirected to 'http:host/training_webapi/', which is disallowed for cross-origin requests that require preflight.
  </code></pre>