title: Laravel POST request Cors No 'Access-Control-Allow-Origin'
body: <p>Currently receiving an error message when I attempt to POST to a given url. GET works fine on the same domain here is my error:</p>
  
  <blockquote>
    <p>Access to XMLHttpRequest at '<a href="http://localhost:8000/api/users/login" rel="nofollow noreferrer">http://localhost:8000/api/users/login</a>'
    from origin '<a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a>' 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.</p>
  </blockquote>
  
  <p>I've found countless questions documenting this same issue all with variations of modify my Cors middleware. </p>
  
  <p>Currently my CORS middleware looks like this:</p>
  
  <pre><code>class Cors
  {
      public function handle($request, Closure $next)
      {
          if ($request-&gt;isMethod('OPTIONS')) {
              $response = Response::make();
          } else {
              $response = $next($request);
          }
          return $response
              -&gt;header('Access-Control-Allow-Origin', '*')
              -&gt;header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS')
              -&gt;header('Access-Control-Allow-Headers', 'Content-Type, Accept, Authorization, X-Requested-With, Application');
      }
  }
  </code></pre>
  
  <p>The error states No 'Access-Control-Allow-Origin' which I believe my <code>-&gt;header('Access-Control-Allow-Origin', '*')</code> should handle since the * is a wild card from my understanding. Is there a different issue at play here I'm missing? Stack is Laravel backend with VueJS front end using Axios for HTTP requests if that is relevant. </p>
  
  <p>Edit: This question is unique in that I already have the headers suggested in most answers specifically: </p>
  
  <pre><code>-&gt;header('Access-Control-Allow-Origin', '*')
  -&gt;header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS')
  </code></pre>
  
  <p>and am still getting the error. </p>