为什么服务器返回错误405添加授权标头时不允许方法?

I have a simple API https://hoply-hoply.c9users.io/api/public/categories.
And below is my test
Angular Code WITH NO header work well (http://codepen.io/phanvanlinh94vn/pen/pEmAPZ)

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
  $http.get("https://hoply-hoply.c9users.io/api/public/categories")
  .then(
    function(response) {
      console.log("success"); console.log(response);
    },
    function (error) {
      console.log("error"); console.log(error);
    });
});

Angular Code WITH header return error 405 (http://codepen.io/phanvanlinh94vn/pen/JRbvZd)

var app = angular.module('myApp', []);
var config = {headers:  {
        'Authorization': 'Bearer d2VudHdvcnRobWFuOkNoYW5nZV9tZQ==',
        'Accept': 'application/json;odata=verbose',
        "X-Testing" : "testing"
 }};
app.controller('myCtrl', function($scope, $http) {
  $http.get("http://hoply-hoply.c9users.io/test_category.php", config)
  .then(
    function(response) {
      console.log("success"); console.log(response);
    },
    function (error) {
      console.log("error"); console.log(error);
    });
});

enter image description here

Here is my PHP (with Slim framework) code for handle return error 405

$container['notAllowedHandler'] = function ($c) {
    return function ($request, $response, $methods) use ($c) {
        return $c['response']
            ->withStatus(405)
            ->withHeader('Allow', implode(', ', $methods))
            ->withHeader('Content-type', 'text/html')
            ->write('Method must be one of: ' . implode(', ', $methods));
    };
};

The problem now is when I remove the PHP block code for handling 405. Both request API (no header and with header) will work fine.
I don't know why this happened. I still want to handle 405 error. How can I fix my problem?

Any help or suggestion would be great appreciated.