Laravel cors 'Access-Control-Allow-Origin' and 'Access-Control-Allow-Headers'
问题 I am new to Laravel. I tried https://github.com/barryvdh/laravel-cors. When I add header('Access-Control-Allow-Origin: *'); in my public/index.php, it does not add the Content-Type in the response. When I add header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: Origin, Content-Type'); It does not add Access-Control-Allow-Origin. I am very confused by all various solutions I find on internet. How exactly should I go about this? 回答1: You can create a new middleware