Responding to HTTP OPTIONS requests in CakePHP
I recently needed to add Access-Control-Allow-Origin headers to resources on an API developed with CakePHP. There’s a good description of how to accomplish this from ThinkingMedia in 2015, but it uses DispatcherFilters, which have since been deprecated in favour of Middleware. The $request and $response objects available to middleware have different interfaces than those retrieved from the event data in the … [Read more…]