{"action":"created","issue":{"url":"https://api.github.com/repos/mikecao/flight/issues/179","labels_url":"https://api.github.com/repos/mikecao/flight/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/mikecao/flight/issues/179/comments","events_url":"https://api.github.com/repos/mikecao/flight/issues/179/events","html_url":"https://github.com/mikecao/flight/issues/179","id":64655950,"number":179,"title":"No 404 response header is sent when using custom 404 error page","user":{"login":"digi-coder","id":11672061,"avatar_url":"https://avatars.githubusercontent.com/u/11672061?v=3","gravatar_id":"","url":"https://api.github.com/users/digi-coder","html_url":"https://github.com/digi-coder","followers_url":"https://api.github.com/users/digi-coder/followers","following_url":"https://api.github.com/users/digi-coder/following{/other_user}","gists_url":"https://api.github.com/users/digi-coder/gists{/gist_id}","starred_url":"https://api.github.com/users/digi-coder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digi-coder/subscriptions","organizations_url":"https://api.github.com/users/digi-coder/orgs","repos_url":"https://api.github.com/users/digi-coder/repos","events_url":"https://api.github.com/users/digi-coder/events{/privacy}","received_events_url":"https://api.github.com/users/digi-coder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-26T23:28:56Z","updated_at":"2015-03-27T04:36:34Z","closed_at":null,"body":"When I override the notFound method by using the map method, as explained in the docs, Flight correctly displays the custom 404 error page but then it no longer sends a 404 response header. I seem to be getting a 200 response instead. Without overriding, Flight correctly sends the 404 response header, along with its generic 404 error message. Is this normal/by design? I tried using:\r\n\r\n    Flight::map('notFound', function(){\r\n        // Display custom 404 page\r\n        include 'errors/404.html';\r\n    });\r\n\r\nand\r\n\r\n    Flight::map('notFound', function(){\r\n        // Display custom 404 page\r\n        Flight::redirect('/new/location', 404);\r\n    };\r\n\r\nand\r\n\r\n    Flight::map('notFound', function(){\r\n        // Display custom 404 page\r\n        Flight::view()->display('@default/errors/404.twig');  \r\n    });"},"comment":{"url":"https://api.github.com/repos/mikecao/flight/issues/comments/86816702","html_url":"https://github.com/mikecao/flight/issues/179#issuecomment-86816702","issue_url":"https://api.github.com/repos/mikecao/flight/issues/179","id":86816702,"user":{"login":"mikecao","id":477975,"avatar_url":"https://avatars.githubusercontent.com/u/477975?v=3","gravatar_id":"","url":"https://api.github.com/users/mikecao","html_url":"https://github.com/mikecao","followers_url":"https://api.github.com/users/mikecao/followers","following_url":"https://api.github.com/users/mikecao/following{/other_user}","gists_url":"https://api.github.com/users/mikecao/gists{/gist_id}","starred_url":"https://api.github.com/users/mikecao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikecao/subscriptions","organizations_url":"https://api.github.com/users/mikecao/orgs","repos_url":"https://api.github.com/users/mikecao/repos","events_url":"https://api.github.com/users/mikecao/events{/privacy}","received_events_url":"https://api.github.com/users/mikecao/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T04:36:34Z","updated_at":"2015-03-27T04:36:34Z","body":"Since you are overriding the default functionality, you need to send the right response code yourself. You can do something like this:\r\n\r\n```php\r\nFlight::map('notFound', function() {\r\n    echo '<h1>404 Not found</h1>';\r\n\r\n    Flight::stop(404);\r\n});\r\n```"}}