laravel handling the OPTION http method request laravel handling the OPTION http method request laravel laravel

laravel handling the OPTION http method request


This is with reference to your question regarding the above issue. You did not mention the version of laravel and angularJS. I assume you are using lattest angularJS and Laravel. I also assume, the angular is hosted on http://localhost:3501 and the laravel is hosted on http://localhostJust follow the below steps.

  • Put below code block in /public/.htaccess file of laravel

    Header set Access-Control-Allow-Origin "http://localhost:3501"Header set Access-Control-Allow-Methods "GET,POST,PUT,DELETE,OPTIONS"Header set Access-Control-Allow-Credentials "true"
  • Put below line in config of angular

    $httpProvider.defaults.withCredentials = true;

Never use * as wild card character. Larvel can not identify the domain for session management. So set http://localhost:3501 as full domain name to Access-Control-Allow-Origin.I think these will help you.


It's a bug in Laravel that got recently fixed. You may want to update to the latest revision.

Also, you need to enable CORS support for your server.


add this in your index.php file

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');