Skip to content

Commit 0df48a8

Browse files
committed
Simple CORS support
1 parent 5df1d7e commit 0df48a8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

HTTP/CORS.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?PHP
2+
Namespace artnum\HTTP;
3+
4+
class CORS
5+
{
6+
function optionsAction ($req) {
7+
header('Allow: GET, POST, PUT, DELETE, OPTIONS');
8+
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
9+
header('Access-Control-Allow-Origin: *');
10+
header('Access-Control-Max-Age: 3600');
11+
header('Access-Control-Allow-Headers: x-requested-with, x-artnum-reqid, content-type');
12+
}
13+
}

HTTPController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
Namespace artnum;
2828

29-
class HTTPController
29+
class HTTPController extends \artnum\HTTP\CORS
3030
{
3131
protected $Model;
3232

0 commit comments

Comments
 (0)