-
Improvement
-
Resolution: Fixed
-
Minor
-
Future Dev
-
MOODLE_310_STABLE
-
MDL-56041-custom-error-pages -
This is a follow on issue from MDL-55916, but it also touches on a bunch of other issues. The status code that moodle returns for lots of pages aren't great, and the pages which are served under these conditions aren't great either. These could all be logged individually but I think are worth sorting holistically together.
So current problems:
- If a url is valid, but the page throws an exception, then this is served as a 404 when it should be a 500 (or maybe 503)
- But if I go to a page for a record which doesn't exist, using MUST_EXIST, this throws an exception, but should be a 404 (and currently is a 404)
- If a url is valid, and you are logged in, but don't have a capability, eg /cohort/index.php?contextid=3 as a student then I get a 404 but I should get a 403 Forbidden instead
- If I go to /admin/index.php as a student then I get a 200 page, I should get a 403
- If I go to a page which isn't a moodle script I get a 404 from apache / nginx which is probably different to the 404 that moodle would give me
- If I am using the clean urls plugin / rewriting api, and I have a url which isn't routable, I should also serve a 404 (working fine) but I should also get the same 404 error page as the other two 404 use cases above
- There is /error/index.php but it's not very good, ie even if you set it up, all of the moodle 404's above don't use this page, only the apache 404's
- If I put the site into cli maintenance mode I get a vanilla unthemed 503 page, you can create a template file but it's static html, not php
- If I put the site into 'gui' maintenance mode, it doesn't use the template above!
- It's hard for a moodle to customize any of this
So what I'm proposing is a common page layout / api / files / renderers, similar to what I think the /error/ page was trying to achieve but just done properly. Importantly they would be designed to be called from either apache or from within moodle.
I haven't thought it through completely, but off the top off my head I think we want a renderer / template for each type of error 403, 404 etc, a theme layout common to all errors, and fixing all of the above to send the correct headers and then defer to the right page. And also a set of instructions for setup with apache / nginx etc
Related wiki pages:
https://docs.moodle.org/38/en/Linking_Moodle_and_Docs#Removing_Moodle_Docs_links_for_teachers
New wiki page:
- has a non-specific relationship to
-
MDL-56036 Webservices errors should throw proper http code
- Closed
- has been marked as being related by
-
MDL-58281 Wrong Content-Length in 'readfile_accel' if file does not exist.
- Closed
-
MDL-64473 Allow an administrator to set an arbitrary http return code for maintenance mode
- Closed
-
MDL-55916 Maintenance mode should serve a http 503 instead of a 200
- Closed
-
MDL-69333 Reduce ability to fingerprint a server with a htaccess-dist / nginx file / docs
- Closed
-
MDL-71012 HTTP 503 Service Not Available is returned by exceptions and should be 500 instead
- Closed
- will help resolve
-
MDL-69958 Support /.well-known/password-change requests from password managers
- Closed