We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

I can't render error 401 page

In the Invo tutorial I just can't render a page for the error 401, no matter what I do. Trying to enter https://mysite.local/errors/show401 I just get a "Dispatcher has detected a cyclic routing causing stability problems" message.

If I try the same for errors 404 or 500 (like mysite.local/errors/show500), for example, it works fine.

Assuming you have and action and view for the show401Action perhaps it may have something to do with how the Invo NotFoundPlugin.php doesn't have an option for 401 configured. https://github.com/phalcon/invo/blob/master/app/plugins/NotFoundPlugin.php

Seems like if nothing else is in the way that you shouldn't be getting a cyclic error.



4.0k
Accepted
answer

Whew, after I turned the computer off it seems to be working now... It took me several hours today to tweak, so I'm not sure not what helped. :)

It wasn't the NotFoundPlugin, because I'd turned it off (temporarily).



4.0k

Possibly this was the problem:

if (!isset($this->persistent->acl)) {



4.0k
edited Feb '15

Yes, I guess I've located the problem! It was (partly) related to this persistent thing. But the main point is 'show401' was not in the public area rules:

//class SecurityPlugin ... $publicResources = array( 'index' => array('index'), 'about' => array('index'), 'register' => array('index'), 'errors' => array('show404', 'show500'), // <--- ...

So, it was like: "Show this 401 error page, but we're not allowed to show it and redirect to 401 page:

$dispatcher->forward(array( 'controller' => 'errors', 'action' => 'show401' and so on..."