This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When using Nuxt.js in universal mode, bounded to extra domain API written in OctoberCMS, | |
// this solves CORS issue in Firefox and Safari (network error during page change) | |
Route::options('/{any}', function() { | |
$headers = [ | |
'Access-Control-Allow-Methods'=> 'POST, GET, OPTIONS, PUT, DELETE', | |
'Access-Control-Allow-Headers'=> 'X-Requested-With, Content-Type, X-Auth-Token, Origin, Authorization' | |
]; | |
return \Response::make('You are connected to the API', 200, $headers); | |
})->where('any', '.*'); |