Update HTTP error messages

This commit is contained in:
Miraty 2022-11-01 21:06:42 +01:00
parent d186db1432
commit a79f8f5251
21 changed files with 97 additions and 92 deletions

@ -1 +1 @@
Subproject commit a63cf55c722e2a9bdb6c1b1d3b7d861fb7ae7f8f
Subproject commit 068dc82a542178c56fd1b49e4309e5b1b994ca4f

@ -1 +1 @@
Subproject commit 5bd2bcaad16a46bb01db04f862c09e14f248a4e8
Subproject commit fbe714909c09701253c3f7e6254a2fab42b35161

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bad request · HTTP 400</title>
</head>
@ -10,6 +10,6 @@
<p>
The request is malformed.
</p>
<small><code>HTTP 400</code></small>
<small>HTTP <code>400</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Access forbidden · HTTP 403</title>
</head>
@ -10,6 +10,6 @@
<p>
The server refused to process the request for security reasons.
</p>
<small><code>HTTP 403</code></small>
<small>HTTP <code>403</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>File not found · HTTP 404</title>
</head>
@ -14,6 +14,6 @@
<li>The file may have been moved or deleted.</li>
<li>Perhaps the address was mistyped.</li>
</ul>
<small><code>HTTP 404</code></small>
<small>HTTP <code>404</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fichier introuvable · HTTP 404</title>
</head>
@ -11,9 +11,9 @@
Le serveur n'a rien trouvé à l'adresse demandée.
</p>
<ul>
<li>Le fichier a put être déplacé ou supprimé.</li>
<li>Le fichier a pu être déplacé ou supprimé.</li>
<li>L'adresse a peut-être été mal saisie.</li>
</ul>
<small><code>HTTP 404</code></small>
<small>HTTP <code>404</code></small>
</body>
</html>

View File

@ -16,5 +16,3 @@ if (isset($locale) AND $locale == "fr")
echo file_get_contents("404.fr.html");
else
echo file_get_contents("404.en.html");
?>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Method Not Allowed · HTTP 405</title>
</head>
@ -10,6 +10,6 @@
<p>
The request method is not supported for this resource.
</p>
<small><code>HTTP 405</code></small>
<small>HTTP <code>405</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gone · HTTP 410</title>
</head>
@ -10,6 +10,6 @@
<p>
The requested resource is not available anymore.
</p>
<small><code>HTTP 410</code></small>
<small>HTTP <code>410</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>I'm a teapot · HTTP 418</title>
</head>
@ -10,6 +10,6 @@
<p>
Your coffee cannot be brewed because this server is a teapot.
</p>
<small><code>HTTP 418</code></small>
<small>HTTP <code>418</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Server error · HTTP 500</title>
</head>
@ -14,6 +14,6 @@
<li>This error is probably temporary.</li>
<li>If it isn't, you can try to contact an administrator.</li>
</ul>
<small><code>HTTP 500</code></small>
<small>HTTP <code>500</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bad gateway · HTTP 502</title>
</head>
@ -14,6 +14,6 @@
<li>This error is probably temporary.</li>
<li>If it isn't, you can try to contact an administrator.</li>
</ul>
<small><code>HTTP 502</code></small>
<small>HTTP <code>502</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Service unavailable · HTTP 503</title>
</head>
@ -14,6 +14,6 @@
<li>This error is probably temporary.</li>
<li>If it isn't, you can try to contact an administrator.</li>
</ul>
<small><code>HTTP 503</code></small>
<small>HTTP <code>503</code></small>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gateway timeout · HTTP 504</title>
</head>
@ -14,6 +14,6 @@
<li>This error is probably temporary.</li>
<li>If it isn't, you can try to contact an administrator.</li>
</ul>
<small><code>HTTP 504</code></small>
<small>HTTP <code>504</code></small>
</body>
</html>

View File

@ -1,11 +1,15 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Broken site</title>
</head>
<body>
<h1>Broken site</h1>
The site you're trying to reach is misconfigured. This domain seems to be pointing to this server, but this server is not aware of a site using this domain.
<p>
The site you're trying to reach is misconfigured. This domain seems to be pointing to this server, but this server is not aware of a site using this domain.
</p>
<small>HTTP <code>404</code></small>
</body>
</html>

View File

@ -1,11 +1,15 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nothing here</title>
</head>
<body>
<h1>Nothing here</h1>
You reached Niver's default site using IP address. There's nothing for you here.
<p>
You reached Niver's default site using IP address. There's nothing for you here.
</p>
<small>HTTP <code>404</code></small>
</body>
</html>

View File

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Not available over unsecure HTTP</title>
</head>
<body>
<h1>Not available over unsecure HTTP</h1>
<p>
This server does not accept unsecure HTTP requests. Use HTTPS instead.
</p>
<details open="">
<summary>What happened?</summary>
You made a request to the server using the unsecure HTTP protocol (<code>http://</code>). For privacy and security reasons, the server does not accept this, as unsecure HTTP connections can be watched and modified by any device on the way.
</details>
<details>
<summary>How to solve this?</summary>
You can tell your browser to use HTTPS by prefixing the URL with <code>https://</code>.
</details>
<small><code>HTTP 400</code></small>
</body>
</html>

View File

@ -1,45 +1,21 @@
<?php
http_response_code(403);
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$clientLocales = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$clientLocales = preg_replace("#[A-Z0-9]|q=|;|-|\.#", "", $clientLocales);
$clientLocales = explode(',', $clientLocales);
$availableLocales = array('en', 'fr');
foreach ($clientLocales as $clientLocale) {
if (in_array($clientLocale, $availableLocales)) {
$locale = $clientLocale;
break;
}
if (in_array($clientLocale, $availableLocales)) {
$locale = $clientLocale;
break;
}
}
}
if (isset($locale) AND $locale == "fr") {
# echo file_get_contents("404.fr.html");
#else { ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Not available over unsecure HTTP</title>
</head>
<body>
<h1>Not available over unsecure HTTP</h1>
<p>
This server does not accept unsecure HTTP requests. <a href="<?php echo htmlspecialchars($_SERVER['QUERY_STRING']);
?>">Use HTTPS</a> instead.
</p>
<details open="">
<summary>What happened?</summary>
You made a request to the server using the unsecure HTTP protocol (<code>http://</code>). For privacy and security reasons, the server does not accept this, as unsecure HTTP connections can be watched and modified by any device on the way.
</details>
<details>
<summary>How to solve this?</summary>
You can tell your browser to use HTTPS by prefixing the URL with <code>https://</code>.
</details>
<small><code>HTTP 403</code></small>
</body>
</html>
<?php } ?>
if (isset($locale) AND $locale === "fr")
require "unsecure.fr.php";
else
require "unsecure.en.php";

View File

@ -1,8 +1,8 @@
<?php
if (filter_var(str_replace(array("[", "]"), "", $_SERVER['HTTP_HOST']), FILTER_VALIDATE_IP))
http_response_code(404);
if (filter_var(str_replace(array('[', ']'), '', $_SERVER['HTTP_HOST']), FILTER_VALIDATE_IP))
echo file_get_contents("default-ip.en.html");
else
echo file_get_contents("default-domain.en.html");
?>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TLS required</title>
</head>
<body>
<h1>TLS required</h1>
<p>
This site does not accept HTTP requests without TLS.
</p>
<h2>What happened?</h2>
<p>
You made a request using HTTP without TLS to the server, which refused this for privacy and security reasons, as unsecure HTTP connections can be watched and modified by any device on the way.
</p>
<h2>How to solve this?</h2>
<p>
You can replace the URI scheme <code>http</code> by <code>https</code> to tell your client to make the request using TLS.
</p>
<code>HTTP 403</code>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nécessite TLS</title>
</head>
<body>
<h1>Nécessite TLS</h1>
<p>
Ce site n'accepte pas les connexions HTTP sans TLS.
</p>
<h2>Que s'est-il passé ?</h2>
<p>
Vous avez envoyé une requête HTTP sans TLS au serveur, qui l'a refusée pour des raisons de sécurité et de confidentialité.
</p>
<h2>Comment régler ce problème ?</h2>
<p>
Vous pouvez remplacer le schéma d'URI <code>http</code> par <code>https</code> pour indiquer à votre client de faire la requête avec TLS.
</p>
<code>HTTP 403</code>
</body>
</html>