title: CORS issue with upgrade Rails 4 to Rails 5
body: <p>I am upgrading Rails application from <code>Rails 4.1.1</code> to <code>Rails 5.1.4</code>. 
  I have 2 applications, One is Web app(using for <code>angular</code>), and other is API app. </p>
  
  <p>What I am doing, I am sending request from <code>Web app(Rails with Angular)</code> and fetching data from <code>API app</code>. But when I send request from <code>Web app</code> got error mentioned below:</p>
  
  <blockquote>
    <p>Failed to load <a href="http://api.myapp:3001/user" rel="nofollow noreferrer">http://api.myapp:3001/user</a>: Response to preflight
    request doesn't pass access control check: 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://myapp:3000" rel="nofollow noreferrer">http://myapp:3000</a>' is therefore not allowed access. The credentials
    mode of requests initiated by the XMLHttpRequest is controlled by the
    withCredentials attribute.</p>
  </blockquote>
  
  <pre><code>http://myapp:3000' -&gt; Web application and request sending to API
  
  http://api.myapp:3001/user -&gt; API application to send response
  </code></pre>
  
  <p>After <code>google</code> the issue, I found one gem called <code>rack-cors</code>. 
  In Web and API both application, I have added </p>
  
  <pre><code>config.middleware.insert_before 0, Rack::Cors do
    allow do
      origins '*'
      resource '*', :headers =&gt; :any, :methods =&gt; [:get, :post, :options]
    end
  end
  </code></pre>
  
  <p>But still getting the issue. Please let me know.</p>