English 中文(简体)
Laravel +Vuejs CORS issue
原标题:

I am facing a dilemma wit the CORS issue. I have application that is configured as follow: API: https://abc.mydomain.com (laravel) front end: https://subdomain.mydomain.com(VueJS) Both applications have its own virtual host setup using SSL. The problem I am facing is, currently I have about 35 API routes and they all work fine; however I have ONE route that gives the following Cors error: Response to preflight request doesn t pass access control check: Redirect is not allowed for a preflight request I have tried the following:

  1. Install reverse proxy(apache)
  2. headers in .htaccess
  3. add headers in the index.php
  4. add headers in the virtual host entry
  5. cors.php manipulatation below is my setup cors.php

     allowed_methods  => [ * ],

     allowed_origins  => [ * ],

     allowed_origins_patterns  => [],

     allowed_headers  => [ * ],

     exposed_headers  => [],

     max_age  => 0,

     supports_credentials  => false,

http.js

let config = {
      baseURL: vue_config.baseURLApi,
      crossdomain: true,
      headers: {
         Access-Control-Allow-Origin :  * ,
         Accept :  application/json ,
         Content-Type :  application/json ,
         X-Requested-With :  XMLHttpRequest ,
        common: {
           Authorization : `Bearer ${auth_token}`,
        }
      }

I am not sure what else to try. Can someone help. Again. only ONE route give the CORS issue and the controller being used by this route does not have any custom middleware manipulation.

问题回答

暂无回答




相关问题
How to fix CORS for Capacitor/Quasar App in a Laravel API

I have an App built on top of Quasar and Capacitor, with an API built on top of Laravel. Everything works well on the dev environment until I build and install the app on my phone, then I keep getting ...

Laravel +Vuejs CORS issue

I am facing a dilemma wit the CORS issue. I have application that is configured as follow: API: https://abc.mydomain.com (laravel) front end: https://subdomain.mydomain.com(VueJS) Both applications ...

Why does CORS not seem to work with POST?

Mozilla s own specification says simple GET or POST should be natively CORS s without preflighting but so far every POST attempt I ve made has resulted in an OPTIONS header going out. When I change ...

热门标签