Laravel 5 + AngularJS Cross Domain CORS

后端 未结 7 1589
暖寄归人
暖寄归人 2020-12-31 23:28

I have searched everywhere for an answer but nothing have worked so far. All the listed solutions on stack have not proven to be sufficient.

I get nothing in my lar

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 23:34

    Add these lines in your public/index.php:

    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
    header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token'); // allow certain headers 
    

    See, if that works.

提交回复
热议问题