[Catalyst] 404 and Catalyst

Lars Balker Rasmussen lars at balker.dk
Wed May 17 15:29:04 CEST 2006


On Wed, May 17, 2006 at 09:19:21AM -0400, Ryan wrote:
> Im trying to submit the site to google sitemap and it complains
> 
> "We've detected that your 404 (file not found) error page returns a
> status of 200 (OK) in the header."
> 
> and I'm assuming this is because of the catch-all that's in place so no
> matter what url a guest goes to they get the homepage(if the controller
> or static page does not exist).  Is there a way around this while
> keeping the catch-all, is there a way I can see if the controller is not
> found in the default end and set the status to 404 instead of 200?

Your default-handler is only called when there was no matching controller.

So just add

    $c->res->status(404);

to your default-handler, and people will still get the intended page if
in a browser.
-- 
Lars Balker Rasmussen                                        Consult::Perl



More information about the Catalyst mailing list