title: ngResource and Access-Control-Allow-Origin
body: <p>I have set up a REST service using java and jetty with a CORS filter:</p>
  
  <pre><code>    response
          .header("Access-Control-Allow-Origin", "*")
          .header("Access-Control-Allow-Methods", "GET, POST, OPTIONS, DELETE, PUT");
  </code></pre>
  
  <p>I then try to fetch data from the rest service using AngularJS and ngResource:</p>
  
  <pre><code>$scope.nodes = $resource("http://localhost:8080/rest/forum/categories").query();
  </code></pre>
  
  <p>When I run the code I get the following message in the console log:</p>
  
  <pre><code>XMLHttpRequest cannot load http://localhost/rest/forum/categories. 
  No 'Access-Control-Allow-Origin' header is present on the requested resource. 
  Origin 'http://localhost:7000' is therefore not allowed access.
  </code></pre>
  
  <p>It seems that it has removed the :8080 from the URL in some way. </p>
  
  <p>When I try to fetch the REST URL just using the browser things are fine. I have even checked the HTTP headers that are returned:</p>
  
  <pre><code>Access-Control-Allow-Methods:GET, POST, OPTIONS, DELETE, PUT 
  Access-Control-Allow-Origin:* 
  Content-Type:application/json
  </code></pre>
  
  <p>Can someone tell my where I have gone wrong here?</p>