laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.78k stars 296 forks source link

CORS response when starting server with swoole #240

Closed filip-codes closed 3 years ago

filip-codes commented 3 years ago

Description & Steps To Reproduce:

Hey guys,

  1. I have installed a fresh Laravel app
  2. I ran ./vendor/bin/sail up to boot the app in Docker
  3. I've installed fruitcake/laravel-cors package and added middleware in Kernel.php
  4. I've installed laravel/octane package and set Swoole as server in the supervisor file
  5. I ran "php artisan octane:start --watch" and the server booted and I can also access the url in my browser
  6. Then I have created a fresh Nuxt.js app & installed axios module
  7. I have created a button and I am sending a request with axios to "http://localhost:8000/api"

It is returning a 204 CORS error. Does anyone know how to get this work?

I know that the Octane Swoole server runs in Docker. But maybe that's what's causing it problems, because the Nuxt.js and the Laravel project are not "on the same network". Or am I wrong about that?

Need help :/

filip-codes commented 3 years ago

Fixed by following this tutorial: https://dev.to/keikesu0122/a-simple-way-to-enable-cors-on-laravel-55i