Opened 6 years ago

Closed 6 years ago

#30521 closed Cleanup/optimization (fixed)

Default error webpages are not correctly-formed html pages.

Reported by: Ruben Garcia Owned by: Alexandre Varas
Component: Error reporting Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The default page served for the 404 error in "DEBUG=False" mode is (django 2.2.1):
<h1>Not Found</h1><p>The requested resource was not found on this server.</p>

I would expect that by default, a full webpage is sent to the user, thus:
<html>
<body>
<h1>Not Found</h1><p>The requested resource was not found on this server.</p>
</body>
</html>

In "DEBUG=True" mode, the webpage served is correct html:
<!DOCTYPE html>
<html lang="en">
...
</html>

Change History (5)

comment:1 by Mariusz Felisiak, 6 years ago

Summary: Default error webpages are not correctly-formed html pagesDefault error webpages are not correctly-formed html pages.
Triage Stage: UnreviewedAccepted
UI/UX: unset
Version: 2.2master

Thanks for the report. I'm not sure if we should complicate all default error pages. It is documented that by default error views produce a very simple messages and it is also still recommended as good practice to provide custom templates in order to present pretty error pages to the user. You can also customize error views. To sum up default error pages are just a fallback, but OK we can accept this as a simple cleanup.

comment:2 by Alexandre Varas, 6 years ago

Owner: set to Alexandre Varas
Status: newassigned

I'll start working on this ticket.

Following @felixxm comment I'll see if a *simple* solution can be applied.

My opinion is that Django should use the corresponding format or at least to be consistent with other responses.

comment:3 by Alexandre Varas, 6 years ago

Has patch: set

Here's my patch PR. It adds html to the response of all default error pages. Any comments?

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 6 years ago

In 3fb0a1a6:

Refs #30521 -- Added tests for content of default error pages.

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 6 years ago

Resolution: fixed
Status: assignedclosed

In c498f088:

Fixed #30521 -- Fixed invalid HTML in default error pages.

Note: See TracTickets for help on using tickets.
Back to Top