Skip to content

Error pages return HTTP 200 instead of correct status codes (403, 404, 500) #4132

@kerojohan

Description

@kerojohan

Describe the bug

In DSpace, pages that should return proper HTTP error codes (e.g., 500, 404, or 403) are instead returning a 200 OK status. This misbehavior affects search engine indexing and SEO, as search engines may incorrectly interpret error pages as valid content.

I’ve tested this issue on the DSpace demo site using Firefox and Chrome, and the following URLs all return a 200 OK status instead of the appropriate error code:

This issue has been observed in both DSpace 7.x and DSpace 8.x.

To Reproduce

Steps to reproduce the behavior:

  1. Open a browser (Chrome, Firefox)
  2. Navigate to one of the following URLs:
  3. Inspect the HTTP response headers (e.g., using browser developer tools or curl -I)
  4. Notice that the status code is 200 OK, even though the page clearly shows an error message

Expected behavior

The HTTP response should return the correct error status code:

  • 404 Not Found for missing pages
  • 403 Forbidden for unauthorized access
  • 500 Internal Server Error for internal failures

This ensures correct behavior for clients and search engines, and improves SEO by preventing incorrect indexing of error pages.

Related work

N/A – please let me know if there's an existing issue or PR related to this.

Metadata

Metadata

Assignees

Labels

affects: 7.xIssue impacts 7.x releasesaffects: 8.xIssue impacts 8.x releasesaffects: mainIssue impacts "main" (latest release).bugcomponent: SEOSearch Engine Optimizationhigh prioritytestathonReported by a tester during Community Testathon

Type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions