404 Error Static Page Plugin - does not issue HTTP Status 404

Hello @mpbraendle

Thank you for pointing out this issue. I’ve reviewed the plugin code and believe I have addressed the problem for version 3.4.0. The updates have been applied to both emerging-neurologist.org and opus.u-paris.fr. Now, using your test, the response is as follows:

curl -I "https://emerging-neurologist.org/wrong_url343ezfz"
HTTP/1.1 404 Not Found
Date: Mon, 12 Feb 2024 17:44:59 GMT
Server: Apache
cache-control: no-store
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Robots-Tag: all
Content-Security-Policy: upgrade-insecure-requests
Content-Type: text/html; charset=utf-8 

Also now there is no more url redirection.

To make it work I had to replace :

public static function handle404() {
	header("Location: ".Application::get()->getRequest()->url(null, '404'));
	fatalError('404 Not Found');
}

by :

public static function handle404() {
	header("HTTP/1.1 404 Not Found");
	$templateMgr = TemplateManager::getManager(Application::get()->getRequest());
	$templateMgr->display('plugins/generic/error404/templates/frontend/pages/page404.tpl');
	exit;
}

A similar change can be made for the version 3_3_0 but I can’t test it at the moment as all my platforms are at version 3.4.x.