{"action":"created","issue":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/4149","repository_url":"https://api.github.com/repos/silverstripe/silverstripe-framework","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/4149/labels{/name}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/4149/comments","events_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/4149/events","html_url":"https://github.com/silverstripe/silverstripe-framework/issues/4149","id":72353919,"number":4149,"title":"RFC-2 Error page simplification","user":{"login":"jonom","id":1079425,"avatar_url":"https://avatars.githubusercontent.com/u/1079425?v=3","gravatar_id":"","url":"https://api.github.com/users/jonom","html_url":"https://github.com/jonom","followers_url":"https://api.github.com/users/jonom/followers","following_url":"https://api.github.com/users/jonom/following{/other_user}","gists_url":"https://api.github.com/users/jonom/gists{/gist_id}","starred_url":"https://api.github.com/users/jonom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonom/subscriptions","organizations_url":"https://api.github.com/users/jonom/orgs","repos_url":"https://api.github.com/users/jonom/repos","events_url":"https://api.github.com/users/jonom/events{/privacy}","received_events_url":"https://api.github.com/users/jonom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/rfc/draft","name":"rfc/draft","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":46,"created_at":"2015-05-01T04:43:47Z","updated_at":"2016-03-02T23:16:09Z","closed_at":null,"body":"# RFC-2 Error page simplification\r\n\r\nAuthor: @jonom\r\nStatus: Pending review\r\nVersion: 1.2.1 (2015-12-28)\r\n\r\n## Purpose and outcome\r\n\r\nThis RFC aims to address a few issues with the SilverStripe CMS:\r\n\r\n1. **Flaws** Statically generated error pages are under-utilised and go stale quickly.\r\n2. **Inflexibility** 'Error content' management is not a requirement for many websites, and a different approach may be preferred where it is.\r\n2. **Confusion** The ErrorPage model leads to a confusing CMS experience.\r\n\r\nSince the current `ErrorPage` implementation is suitable for some sites but not all, this proposal recommends removing the `ErrorPage` class from core and moving it in to a separate optional module. This would extend upon a bare-bones error response base in core, and pave the way for developers to create alternate solutions for managing, displaying, and caching error response content that suits their needs better.\r\n\r\nCommunity is welcome to give feedback. The proposal will be submitted to the core-committers for approval.\r\n\r\n## Motivation\r\n\r\n### Static error pages easily become stale and broken\r\nThey are generated on dev/build but only if they don't already exist. After that they are only regenerated when re-published from the CMS. This means the static pages can easily become very out of date, and even include dev-environment content rendered when the website project was first initiated.\r\n\r\n### Static error pages are not widely utilised\r\nOn a regular SilverStripe installation directives in the .htaccess file suggest that error responses will be handled efficiently by Apache serving up a static error page. This is true for a 500 response, but all 404 responses in fact go through the full SilverStripe request cycle and a dynamic error response is generated, meaning the static 404 file is never used. In the case of a fatal error Apache serves the 500 error page because PHP has aborted the response. Hopefully this situation doesn't happen often, but when it does it is likely that a stale error page is being served.\r\n\r\n### Inflexible error response model\r\n\r\n- The use of ErrorPage content [removes the ability to set a custom error message](https://www.silverstripe.org/community/forums/general-questions/show/15289) from code using `ContentController::httpError($code, $message)` (`$message` is ignored)\r\n- Error responses which don't have a corresponding ErrorPage published in the CMS will show the content for a 500 Server Error which is misleading.\r\n- Static error pages are only generated for the default language (can anyone confirm this?) and primary Subsite.\r\n\r\n### ErrorPages confuse regular (non-technical) CMS users\r\n\r\n- It doesn't make sense to show error pages in the Site Tree and allow drag and drop re-ordering, since they aren't part of a website's menu structure or information architecture.\r\n- Non-technical CMS users are generally not interested in editing error page content\r\n- Non-technical CMS users read the labels in the Site Tree and think something has gone wrong, not making the connection that there is content there they can edit\r\n\r\n\r\n## Proposal\r\n\r\n### Remove ErrorPage from core and split off in to an optional module\r\n\r\nThe ErrorPage class brings with it some UX problems and flaws as outlined above, and is not needed in every CMS installation, so let's separate it out in to an optional module. This will make the CMS experience simpler and cleaner for users who don't need this functionality.\r\n\r\n### Provide a simple error response mechanism that can be overridden or replaced\r\n\r\n[RequestHandler::httpError()](http://api.silverstripe.org/3.2/class-RequestHandler.html#_httpError) already provides a plain-text error response with default descriptions for a range of status codes, with extension points that allow you to customise the response to your liking. This means we already have a good base in place that can be built upon with modules.\r\n\r\n### Don't cache error page content by default\r\n\r\nWe're not effectively caching error page content at the moment and don't have built-in caching for any other content so let's leave that functionality to dedicated modules.\r\n\r\n#### (Except for the 500 error page)\r\n\r\nWe can't serve up a dynamically generated response in the event of a fatal error, so let's provide a simple static html page for this purpose. This could be manually replaced or customised if desired to match the look of the website. This may not be ideal for all websites but it is just a starting point that can be expanded upon with modules.\r\n\r\n### Other considerations\r\n\r\n- This RFC does not propose any solutions for fixing existing problems with `ErrorPage` for developers that choose to go on using it as a module. Upgrades to that module would be a good idea but are out of scope for this RFC.\r\n- Who will be responsible for maintaining the ErrorPage module? (SilverStripe Ltd?)\r\n- Document upgrade path\r\n\t- install ErrorPage module or remove ErrorPage instances)\r\n\t- recommend some alternative modules and pros/cons if/when available\r\n- Update docs\r\n- Should Installer require ErrorPage as a dependancy or a simpler alternative?\r\n\r\n## (Partial) Alternatives\r\n\r\n### Fix generation of static error pages\r\n\r\n- How do we ensure error pages are regenerated regularly? dev/build is not done regularly and a basic SilverStripe installation doesn't currently require cron jobs to be set up. Generating and caching pages at request time may be an option.\r\n- How will we know we need to serve up a static 404 without going through the request process and hitting the database? If we can't solve this problem any performance gains to be made by saving a static error page will be similar to serving up a 404 page that has been cached using partial caching.\r\n- How to support multi-domains, translation, SSL vs non-SSL...?\r\n\r\nThese are difficult questions to answer so this doesn't seem like a good solution.\r\n\r\n### Separate out error pages from SiteTree\r\n\r\nErrorPages could be visually separated at the bottom of the SiteTree, or moved to the Settings section of the CMS, to reduce confusion and clutter. However if most websites don't actually need the ability to edit error page content in the CMS, and we're adhering to 'Convention over Configuration' then this functionality should be optional in the form of a separate module.\r\n\r\n## Impact\r\n\r\n- The ErrorPage module will need to be installed on websites where that functionality is required, including:\r\n\t- Websites that rely on a fully-themed 500 error response\r\n\t- Websites that are making use of the static 404 page (non-standard configurations)\r\n- If the ErrorPage module is not installed, developers will likely want to install an alternative module or implement their own solution to enhance error responses beyond plain-text."},"comment":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/comments/191488478","html_url":"https://github.com/silverstripe/silverstripe-framework/issues/4149#issuecomment-191488478","issue_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/4149","id":191488478,"user":{"login":"sminnee","id":59968,"avatar_url":"https://avatars.githubusercontent.com/u/59968?v=3","gravatar_id":"","url":"https://api.github.com/users/sminnee","html_url":"https://github.com/sminnee","followers_url":"https://api.github.com/users/sminnee/followers","following_url":"https://api.github.com/users/sminnee/following{/other_user}","gists_url":"https://api.github.com/users/sminnee/gists{/gist_id}","starred_url":"https://api.github.com/users/sminnee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sminnee/subscriptions","organizations_url":"https://api.github.com/users/sminnee/orgs","repos_url":"https://api.github.com/users/sminnee/repos","events_url":"https://api.github.com/users/sminnee/events{/privacy}","received_events_url":"https://api.github.com/users/sminnee/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T23:16:09Z","updated_at":"2016-03-02T23:16:09Z","body":"> I think we need to find a way to make it content manageable.\r\n\r\nThat would be part of the errorpage module, surely? Otherwise we're not splitting this functionality into a module, we're just rewriting the functionality."}}