OFFLINE-GmbH / oc-cors-plugin

Setup and manage Cross-Origin Resource Sharing headers in October CMS
MIT License
12 stars 6 forks source link

CORS Preflight Did Not Succeed with routes #9

Closed Incremental92 closed 3 years ago

Incremental92 commented 3 years ago

Hello, I'm using your CORS plugin on October and a Vue application for Frontend with axios. It was previously working with https://octobercms.com/plugin/rluders-cors but due to dependencies problems with October, I moved to your plugin and https://octobercms.com/plugin/vdomah-jwtauth

In Firefox console I get : "CORS Preflight Did Not Succeed" and "Cross-Origin Request Blocked" when I call a route declared in my plugin/route.php. Could it be a problem with JWT or CORS ? CORS has :

In October, my plugin, I have a route.php with :

Route::post('Change-Pwd', function (\Request $request) { return response()->json(('The test was successful')); })->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');

Typing directly the URL, I get a 404 error. With axios I get the CORS error.

Thanks for your help, I'm searching since a long time...

tobias-kuendig commented 3 years ago

You need to make sure to issue a POST request, by typing the URL in your browser you issue a GET request, and therefore get a 404 error.

Use a tool like Insomnia or Postman to issue a OPTIONS request to your URL. If the CORS plugin is set up correctly, you should see the CORS headers in your response.

tobias-kuendig commented 3 years ago

This should be fixed by #8

Incremental92 commented 3 years ago

Thanks a lot ! Will you move it to Winter CMS ?