Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static error pages not generated when site restricted to login #17

Open
axllent opened this issue Jan 27, 2018 · 2 comments
Open

Static error pages not generated when site restricted to login #17

axllent opened this issue Jan 27, 2018 · 2 comments

Comments

@axllent
Copy link

axllent commented Jan 27, 2018

I'm not sure whether this is intentional or not, however when Who can view pages on this site? is set to either Logged-in users or "Only these groups" (ie: required permission), a dev/build will generate blank (0-byte) assets/error-(404|500).html files.

@micmania1
Copy link

micmania1 commented Jul 16, 2018

I've also just hit this. We have the entire site protected by login and when an unauthenticated user attempts to view a 404 page, they're given a blank white page with the following text:

ERROR [UNKNOWN TYPE, ERRNO 404]: IN GET /sdf Line in Trace ===== SilverStripe\Dev\CliDebugView->renderTrace() DetailedErrorFormatter.php:119 SilverStripe\Logging\DetailedErrorFormatter->output(404, , , , ) DetailedErrorFormatter.php:54 SilverStripe\Logging\DetailedErrorFormatter->format(Array) HTTPResponse.php:355 SilverStripe\Control\HTTPResponse->outputBody() HTTPResponse.php:283 SilverStripe\Control\HTTPResponse->output() index.php:18

When an authenticated user views a 404 page it works perfectly.

Our workaround at the moment is to change the view permissions to "Anyone" in the CMS.

I'm not sure what the best fix is for this - always set canView to true and remove the CMS permissions?

@axllent
Copy link
Author

axllent commented Aug 5, 2018

The easy solution here would simply to ad a canview() { return true } to ErrorPage. I can't think of any scenario whereby either of those pages would require anything but that, though I may be wrong.

My workaround is a simple extension:

<?php
/**
 * Make all ErrorPages visible regardless of site settings
 *
 */
namespace {

    use SilverStripe\CMS\Model\SiteTreeExtension;

    class ErrorPageExtension extends SiteTreeExtension
    {
        public function canView()
        {
            return true;
        }
    }

}
SilverStripe\ErrorPage\ErrorPage:
  extensions:
    - ErrorPageExtension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants