title: API Proxy Server
body: <p>I'm using ember-cli. Need to make calls to remote server, I don't have control over the API, and CORS is not setup on the API.</p>
  
  <p>I am struggling with getting a proxy server setup. Ideally I would love to use something built into ember-cli. I have seen the proxy option "ember serve --proxy" but I can't figure out how to use it.</p>
  
  <p>I basically want to do: </p>
  
  <pre><code>Ember.$.ajax('https://www.somewhere.com/api/v1/data/plans', {
              "type": 'POST',
              "dataType": 'JSON',
              "data": {
                  "name": "My delivery plan",
                  "date": "2013/11/20",
                  "distance_unit": "mi"
              }, // End data payload
              "success": function (data, textStatus, jqXHR) {
                  return data;
              },
              "error": function (jqXHR, textStatus, errorThrown) {
                  window.console.log(jqXHR);
              }
          });
  </code></pre>
  
  <p>When I do this I get: </p>
  
  <pre><code>XMLHttpRequest cannot load https://www.somewhere.com/api/v1/data/plans. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. 
  </code></pre>
  
  <p>Also looking into nginx, but I have no idea how to set this up locally or how to get it to work with the ember-cli server.</p>
  
  <p>Any help is much appreciated!</p>
  
  <p>Thanks</p>