Bug 29420: HTTP status code incorrect when calling error pages directly under Plack...
authorDavid Cook <dcook@prosentient.com.au>
Wed, 1 Dec 2021 01:31:27 +0000 (01:31 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 20 Apr 2022 19:03:39 +0000 (09:03 -1000)
commit437e5844077cfd7d315f6ef2f6657d5da619925d
tree7e97715ac785bd182907d2bf902f1955508dd6ab
parent05ba079814facb569feb9327992a1dc441753754
Bug 29420: HTTP status code incorrect when calling error pages directly under Plack/PSGI

The error pages wrote a HTTP status code of 200 for all PSGI requests, even
though it should have only done it for PSGI requests from the ErrorDocument
middleware. This patch fixes that.

0) Do not apply patch
1) Open F12 dev tools and go to Network tab
2) Go to http://localhost:8081/files/blah
3) Note that the webpage is a 404 error but HTTP status code is 200
4) Go to http://localhost:8081/cgi-bin/koha/circ/blah
5) Note that the webpage is a 404 error and HTTP status code is 404

6) Apply patch
7) Go to http://localhost:8081/files/blah
8) Note that the webpage is a 404 error and HTTP status code is 404
9) Go to http://localhost:8081/cgi-bin/koha/circ/blah
10) Note that the webpage is a 404 error and HTTP status code is 404

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
13 files changed:
C4/Context.pm
errors/400.pl
errors/401.pl
errors/402.pl
errors/403.pl
errors/404.pl
errors/500.pl
opac/errors/400.pl
opac/errors/401.pl
opac/errors/402.pl
opac/errors/403.pl
opac/errors/404.pl
opac/errors/500.pl