Commit e0793e59 authored by ale's avatar ale

Merge branch 'nice-errors' into 'master'

Display nice HTTP error pages where possible

See merge request !34
parents 091515ec 0ea6f121
Pipeline #3338 passed with stage
in 6 minutes and 6 seconds
<!DOCTYPE html>
<html lang="en">
<head>
<title>429 - Rate limited</title>
<style type="text/css">
body {
color: black;
background-color: #ddd;
font-size: 1.3em;
font-family: "Times New Roman", "Georgia", serif;
}
#main {
width: 60%;
margin: 10% auto;
text-align: center;
}
h1 { font-weight: normal; }
a:link { font-weight: bold; }
img { border: 0; }
.rstar { margin-bottom: -4px; }
</style>
</head>
<body>
<div id="main">
<img src="/__errors/bomb-small-c.png" alt=""/>
<h1>too many requests</h1>
<p>
You sent too many requests for a protected URL
in a short amount of time. Wait a while and
try again later.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>451 - Unavailable For Legal Reasons</title>
<style type="text/css">
body {
color: black;
background-color: #ddd;
font-size: 1.3em;
font-family: "Times New Roman", "Georgia", serif;
}
#main {
width: 60%;
margin: 10% auto;
text-align: center;
}
h1 { font-weight: normal; }
a:link { font-weight: bold; }
img { border: 0; }
.rstar { margin-bottom: -4px; }
</style>
</head>
<body>
<div id="main">
<img src="/__errors/bomb-small-c.png" alt=""/>
<h1>Unavailable for legal reasons</h1>
<p>
This request may not be serviced because some
law court has ordered us not to show it to you.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>500 - Internal Server Error</title>
<style type="text/css">
body {
color: black;
background-color: #ddd;
font-size: 1.3em;
font-family: "Times New Roman", "Georgia", serif;
}
#main {
width: 60%;
margin: 10% auto;
text-align: center;
}
h1 { font-weight: normal; }
a:link { font-weight: bold; }
img { border: 0; }
.rstar { margin-bottom: -4px; }
</style>
</head>
<body>
<div id="main">
<img src="/__errors/bomb-small-c.png" alt=""/>
<h1>the site has an error :-(</h1>
<p>
Something went wrong... <br>
maybe you could try again later.
</p>
<p>
Perhaps maintenance is ongoing?<br>
Check out
<a href="https://cavallette.noblogs.org/">our blog</a>
<img src="/__errors/Rstar22-t.png" class="rstar">
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>502 - Server timed out</title>
<style type="text/css">
body {
color: black;
background-color: #ddd;
font-size: 1.3em;
font-family: "Times New Roman", "Georgia", serif;
}
#main {
width: 60%;
margin: 10% auto;
text-align: center;
}
h1 { font-weight: normal; }
a:link { font-weight: bold; }
img { border: 0; }
.rstar { margin-bottom: -4px; }
</style>
</head>
<body>
<div id="main">
<img src="/__errors/bomb-small-c.png" alt=""/>
<h1>the server timed out :-(</h1>
<p>
Something went wrong... <br>
maybe you could try again later.
</p>
<p>
Perhaps maintenance is ongoing?<br>
Check out
<a href="https://cavallette.noblogs.org/">our blog</a>
<img src="/__errors/Rstar22-t.png" class="rstar">
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>503 - Service unavailable</title>
<style type="text/css">
body {
color: black;
background-color: #ddd;
font-size: 1.3em;
font-family: "Times New Roman", "Georgia", serif;
}
#main {
width: 60%;
margin: 10% auto;
text-align: center;
}
h1 { font-weight: normal; }
a:link { font-weight: bold; }
img { border: 0; }
.rstar { margin-bottom: -4px; }
</style>
</head>
<body>
<div id="main">
<img src="/__errors/bomb-small-c.png" alt=""/>
<h1>service unavailable :-(</h1>
<p>
Something went wrong... <br>
maybe you could try again later.
</p>
<p>
Maintenance seems to be ongoing.<br>
Check out
<a href="https://cavallette.noblogs.org/">our blog</a>
<img src="/__errors/Rstar22-t.png" class="rstar">
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>504 - Gateway timeout</title>
<style type="text/css">
body {
color: black;
background-color: #ddd;
font-size: 1.3em;
font-family: "Times New Roman", "Georgia", serif;
}
#main {
width: 60%;
margin: 10% auto;
text-align: center;
}
h1 { font-weight: normal; }
a:link { font-weight: bold; }
img { border: 0; }
.rstar { margin-bottom: -4px; }
</style>
</head>
<body>
<div id="main">
<img src="/__errors/bomb-small-c.png" alt=""/>
<h1>service unavailable :-(</h1>
<p>
Something went wrong... <br>
maybe you could try again later.
</p>
<p>
Maintenance seems to be ongoing.<br>
Check out
<a href="https://cavallette.noblogs.org/">our blog</a>
<img src="/__errors/Rstar22-t.png" class="rstar">
</p>
</div>
</body>
</html>
......@@ -148,6 +148,17 @@
src: favicon.ico
dest: /var/www/html/favicon.ico
- name: Create the custom error directory
file:
path: /var/www/html/__errors
state: directory
- name: Copy custom error messages
copy:
src: "{{ item }}"
dest: /var/www/html/__errors/
with_fileglob: "errors/*"
# Create the cache directory.
- file:
path: /var/cache/nginx
......
......@@ -29,4 +29,4 @@ proxy_cache_valid 404 1m;
proxy_cache_min_uses 2;
# Show our own error pages, not the remote ones.
#proxy_intercept_errors on;
proxy_intercept_errors on;
# Global error pages.
location /__errors {
root /var/www/html;
allow all;
internal;
}
# Needed otherwise the image-caching directives for noblogs take precedence.
location ~* ^/__errors/(.*\.png)$ {
alias /var/www/html/__errors/$1;
}
error_page 500 /__errors/500.html;
error_page 502 /__errors/502.html;
error_page 503 /__errors/503.html;
error_page 504 /__errors/504.html;
error_page 429 /__errors/429.html;
error_page 451 /__errors/451.html;
......@@ -35,6 +35,7 @@ server {
ssl_certificate_key /etc/credentials/public/{{ endpoint.name }}.{{ domain_public[0] }}/privkey.pem;
include /etc/nginx/snippets/site-limits.conf;
include /etc/nginx/snippets/custom-errors.conf;
location = /favicon.ico {
expires 15d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment