title: Vue-resource blocked by CORS policy
body: <p>I know there's some similar treads but no one solution helped me.</p>
  
  <p>I'm building an application with Ruby on Rails and Vue. Currently, I'm trying to get the Spotify access token of my user. So I just have to create a get request and wait for the response.</p>
  
  <p>It works perfectly from a view created with Rails, but not from my Vue app.</p>
  
  <p>This is the error in my console:</p>
  
  <pre><code>Access to XMLHttpRequest at 'https://accounts.spotify.com/authorize?client_id=261c008xxxxxx52da843b8096d&amp;redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fspotify%2Fcallback&amp;response_type=code&amp;scope=playlist-modify-public+user-read-email&amp;state=5987fec3952e0c46332183c526d0abef2f0d35a13e39694e' (redirected from 'http://localhost:3000/auth/spotify') from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  
  <p><strong>No 'Access-Control-Allow-Origin' header is present on the requested resource.</strong> but if we check headers:</p>
  
  <p><a href="https://i.stack.imgur.com/xmt3Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xmt3Q.png" alt="headers"></a>
  In my js file I have:</p>
  
  <pre><code>Vue.http.interceptors.push(function (request, next) {
    request.headers.set('Content-Type', 'application/json');
    request.headers.set('Access-Control-Allow-Origin', '*');
    request.headers.set('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
    request.headers.set('Access-Control-Allow-Methods', 'POST, GET, PUT, DELETE, OPTIONS');
    request.headers.set('X-CSRF-Token', document.getElementsByName('csrf-token')[0].content);
    next();
  });
  </code></pre>
  
  <p>I don't know where to look, would you have an idea?
  I already tried to install a chrome extension, allow all origins on my server side, replace Vue-resource with Axios, install cors with node...</p>