/**
* preflight action
*/
public function preflightFooAction()
{
#Doing some stuff to handle the preflight
$this->controllerContext->getResponse()->setHeader('Access-Control-Allow-Origin', 'https://api.example.com);
$this->controllerContext->getResponse()->setHeader('Access-Control-Allow-Headers', 'Authorization');
#return empty response
#firefox only accept repsonse with StatusCode 200 NOT 204 in my case
}
/**
* foo action
*/
public function fooAction()
{
}
HTTP OPTIONS will enable controller to handle ajax preflights
Howto handle preflights:
Add route
Implement controller action and preflight