HTTP status code compliance: non-existent and deleted records should return 4xx codes

Bug #1406025 reported by Dan Scott on 2014-12-27
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

* Evergreen master and every version with TPAC

Problem: make an HTTP request for a record that is deleted; although the HTML includes the red-bordered message "This record has been deleted", the HTTP status code will be "HTTP/1.1 200 OK". Arguably, this should be 410 Gone (per

Problem: request a record that does not exist, such as http://localhost/eg/opac/record/9999999999999 (assuming that doesn't exist in your system). The TPAC generates an empty HTML record summary page and returns an HTTP status code of "HTTP1/1 200 OK". Arguably, this should be 404 Not Found, and the HTML should indicate that the record in question does not exist.

Dan Scott (denials) on 2014-12-27
Changed in evergreen:
milestone: none →
Revision history for this message
Dan Scott (denials) wrote :

Created;a=shortlog;h=refs/heads/user/dbs/lp1406025_tpac_http_4xx_codes with a first stab at implementing the 404 / 410 codes in the appropriate circumstances. However, the results are U-G-L-Y for humans; we should enable the TPAC to handle the corresponding problems more elegantly.

Revision history for this message
Dan Scott (denials) wrote :

Added a second commit to the branch which does the dance described at of setting the status to the error code, then resetting the apache status to OK so that the HTML can be generated as before, rather than the ugly default server error page. The HTTP header still shows the 404 or 410 as desired, so that machines can do the right thing.

We do this only for the known cases of HTTP_NOT_FOUND and HTTP_GONE for records; these status codes are otherwise not thrown by our application.

tags: added: pullrequest
Revision history for this message
Ben Shum (bshum) wrote :

Assigning milestone to 2.8-beta for review. Thanks Dan, looks like a good change!

Changed in evergreen:
milestone: → 2.8-beta
status: New → Confirmed
Revision history for this message
Ben Shum (bshum) wrote :

Pushed to master for 2.8 beta. Thanks Dan!

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers