title: CORS issue with Vue.js
body: <p>I'm using:</p>
  
  <ul>
  <li>Vue 2.0.3</li>
  <li>vue-router 2.0.1</li>
  <li>vuex 0.8.2</li>
  <li>vue-resource 0.7.0</li>
  </ul>
  
  <p>And after trying to login to my page when using remote API, not the locally run one, I get cors error like following</p>
  
  <pre><code>vue-resource.common.js?2f13:1074 OPTIONS 
  
  https://mywebsite/api/auth/login 
  
  (anonymous function) @     vue-resource.common.js?2f13:1074
  Promise$1            @     vue-resource.common.js?2f13:681
  xhrClient            @     vue-resource.common.js?2f13:1033
  Client               @     vue-resource.common.js?2f13:1080
  (anonymous function) @     vue-resource.common.js?2f13:1008
  
  
  XMLHttpRequest cannot load https://mywebsite/api/auth/login. 
  Response to preflight request doesn't pass access control check: 
  No 'Access-Control-Allow-Origin' header is present on the requested 
  resource. Origin 'http://localhost:8080' is therefore not allowed 
  access. The response had HTTP status code 415.
  </code></pre>
  
  <p>Now I have API running in Azure, and since it allows me to test my calls from Postman, I am quite sure the CORS headers are set properly on backend.
  Not so sure about the Vue and the front.</p>
  
  <p>I have situation like this in config files:</p>
  
  <pre><code>export const API_ROOT = 'https://mywebsite/api/'
  export const AuthResource = Vue.resource(API_ROOT + 'auth{/action}')
  </code></pre>
  
  <p>than i.e I am calling this action like:</p>
  
  <pre><code>login: function (userData) {
      return AuthResource.save({action: 'login'}, userData)
  }
  </code></pre>
  
  <p>Finally as I am checking auth in login via token in vuex submodule I have
  just a simple header check-up state.</p>
  
  <pre><code>var updateAuthHeaders = () =&gt; {
      var token = JSON.parse(localStorage.getItem("auth_token"))
      if (token != null){
          Vue.http.headers.common['Authorization'] = token
      }else{
          Vue.http.headers.common['Authorization'] = null
      }
  }
  </code></pre>
  
  <p>I have tried adding <code>Vue.http.headers.common['Access-Control-Allow-Origin'] = true</code> here, but did not help the case.</p>
  
  <p>Any idea? What am I doing wrong.. I suppose it will not work for other calls also if it doesn't work for login.</p>