title: rails api, react front end, axios, CORS in development not working
body: <p>I'm sure that this question (or questions very similar) has been asked many times, but I'm new to cross origin requests, and in searching through other people's answers, I haven't been able to send basic requests from a React front end to a rails-api only backend, while both are running locally on development servers.</p>
  
  <p>Any help to resolve this issue/help me understand why it's not working would be really appreciated!</p>
  
  <p>Front end: (as on onClick function handler, running on an npm dev server on port 3000)</p>
  
  <pre><code>function sendGetRequest() {
      Axios.request({
          url: 'http://localhost:3001/users/2',
          method: 'get',
          headers: {
              'Content-Type': 'application/json',
              'Accept': 'application/json'
          },
          withCredentials: true
      }).then(function (response) {
          console.log(response);
      })
      .catch(function (error) {
          console.log(error);
      });
  }
  </code></pre>
  
  <p>Backend (rails rack-cors, running on a rails puma server, on port 3001):</p>
  
  <pre><code>config.middleware.insert_before 0, Rack::Cors do
        allow do
          origins 'localhost:3000'
          resource '*',
            :headers =&gt; :any,
            :expose  =&gt; ['access-token', 'expiry', 'token-type', 'uid', 'client'],
            :methods =&gt; [:get, :post, :put, :patch, :delete, :options, :head]
        end
      end
  </code></pre>
  
  <p>I have verified through postman and rspec that the various controller methods are all responding with JSON appropriately. </p>
  
  <p>When I attempt to run this, I receive errors along the lines of: </p>
  
  <p>"Failed to load <a href="http://localhost:3001/users/2" rel="nofollow noreferrer">http://localhost:3001/users/2</a>: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin '<a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a>' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute."</p>
  
  <p>Thanks so much!</p>