title: Restangular crossdomain request. What I do wrong?
body: <p>I have domain <code>sub.example.com</code> with configured restangular:</p>
  
  <pre><code>RestangularProvider.setDefaultHeaders({
      'Content-Type': 'application/json',
      'X-Requested-With': 'XMLHttpRequest'
  });
  RestangularProvider.setDefaultHttpFields({
      'withCredentials': true
  });
  </code></pre>
  
  <p>Then I'm building other factory via:</p>
  
  <pre><code>return Restangular.withConfig(function(RestangularProvider) {
      RestangularProvider.setBaseUrl('http://api.example.com');
  });
  </code></pre>
  
  <p>And, obviously, getting error <strong>No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://sub.example.com">http://sub.example.com</a>' is therefore not allowed access.</strong>. How should I configure server/client to get working crossdomain requests?</p>
  
  <p>// upd</p>
  
  <p>I'm using Yii on backend and sending next header<br>
  <code>header('Access-Control-Allow-Origin: *', true);</code></p>