title: CORS preflight request error: Redirect is not allowed for a preflight request
body: <p>I have <a href="https://github.com/camohub/tatrytec-vue-admin/blob/master/src/components/articles/ArticlesDataTable.vue" rel="nofollow noreferrer">Vue3 application</a> with Access-Control-Allow-Origin header set up according <a href="https://github.com/fruitcake/laravel-cors#echodie" rel="nofollow noreferrer">documentation</a>
  for the package which sends this headers. Every common GET requests have this headers but if the form request send POST request then Access-Control-Allow-Origin header is not included in the response. It throws an error</p>
  <blockquote>
  <p>Access to XMLHttpRequest at 'https://tatrytec.eu/api/article/store/'
  from origin 'https://vue.tatrytec.eu' has been blocked by CORS policy:
  Response to preflight request doesn't pass access control check:
  Redirect is not allowed for a preflight request.</p>
  </blockquote>
  <p>Here is my config/cors.php</p>
  <pre><code>&lt;?php
  
  return [
  
      /*
      |--------------------------------------------------------------------------
      | Cross-Origin Resource Sharing (CORS) Configuration
      |--------------------------------------------------------------------------
      |
      | Here you may configure your settings for cross-origin resource sharing
      | or &quot;CORS&quot;. This determines what cross-origin operations may execute
      | in web browsers. You are free to adjust these settings as needed.
      |
      | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
      |
      */
  
      'paths' =&gt; ['api/*', 'sanctum/csrf-cookie'],
  
      'allowed_methods' =&gt; ['*'],
  
      'allowed_origins' =&gt; ['*'],
  
      'allowed_origins_patterns' =&gt; [],
  
      'allowed_headers' =&gt; ['*'],
  
      'exposed_headers' =&gt; [],
  
      'max_age' =&gt; 0,
  
      'supports_credentials' =&gt; true,
  
  ];
  </code></pre>
  <p>and this is in Kernel.php</p>
  <pre><code>protected $middleware = [
      // \App\Http\Middleware\TrustHosts::class,
      \Fruitcake\Cors\HandleCors::class,
      \App\Http\Middleware\TrustProxies::class,
      \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
      \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
      \App\Http\Middleware\TrimStrings::class,
      \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
  ];
  </code></pre>
  <p>Here is the code of ArticlesController::store() method which throws an error: <a href="https://github.com/camohub/tatrytec.eu/blob/master/app/Http/Controllers/Api/ArticlesController.php#L63" rel="nofollow noreferrer">https://github.com/camohub/tatrytec.eu/blob/master/app/Http/Controllers/Api/ArticlesController.php#L63</a></p>
  <p>Can somebody tell me please what should I set up in the server code to send required header ? Thanks a lot.</p>