Enable CORS in lumen

前端 未结 2 1710
伪装坚强ぢ
伪装坚强ぢ 2020-12-19 05:40

I have API developed using lumen. I can get request using postman. But when request using Jquery.ajax it is not working. So I need to know how to enable CORS in lumen API.

2条回答
  •  情歌与酒
    2020-12-19 06:38

    I'd recommend using the CORS package by Barry vd. Heuvel: https://github.com/barryvdh/laravel-cors#lumen

    It has configurable and supports Pre-flight request handling for ajax.

提交回复
热议问题