title: CORS enabled in Apache, but AJAX not working (chrome says origin not allowed)
body: <p>I am trying to get some AJAX working between two subdomains.</p>
  
  <p>rails.mydomain.com and mydomain.com</p>
  
  <p>In apache, in /etc/apache2/sites-available/ I have my rails.mydomain.com file:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      Header add Access-Control-Allow-Origin "http://www.mydomain.com"
      Header add Access-Control-Allow-Origin "http://www.dev-mydomain.com"
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>However, whenever i try to do a simple ajax test request from <a href="http://www.dev-mydomain.com">http://www.dev-mydomain.com</a>, in Chrome I get: <strong>"XMLHttpRequest cannot load <a href="http://rails.mydomain.com/directory">http://rails.mydomain.com/directory</a>. Origin <a href="http://www.dev-mydomain.com">http://www.dev-mydomain.com</a> is not allowed by Access-Control-Allow-Origin."</strong></p>
  
  <p>Anyone know what I am missing?</p>