Skip to content

Instantly share code, notes, and snippets.

@ubermuda
Created November 22, 2012 20:40
Show Gist options
  • Select an option

  • Save ubermuda/4132850 to your computer and use it in GitHub Desktop.

Select an option

Save ubermuda/4132850 to your computer and use it in GitHub Desktop.
<?php
$app->after(function(Request $request, Response $response) {
$cors = array(
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'POST',
'Access-Control-Allow-Headers' => 'content-type, x-requested-with'
);
foreach ($cors as $name => $value) {
$response->headers->set($name, $value);
}
});
<?php
$app->match('/link', function() use ($app) {
return new Response('', 200);
})->method('OPTIONS');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment