From ab3c6ee18e795196bdf7482aaaed67824fa55337 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Mon, 5 Apr 2021 20:42:47 +0300 Subject: [PATCH] Add error pages --- Dockerfile | 1 + config/nginx.conf.template | 12 ++++++++++++ errors/451.html | 1 + errors/50x.html | 1 + 4 files changed, 15 insertions(+) create mode 100644 errors/451.html create mode 100644 errors/50x.html diff --git a/Dockerfile b/Dockerfile index 609672d83a..68648c4c62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,6 +52,7 @@ COPY config/nginx.conf.template nginx.conf.template COPY blacklist.txt /etc/tor2web/blacklist.txt COPY disclaimer.html /etc/tor2web/disclaimer.html COPY robots.txt /var/www/html/robots.txt +COPY errors /etc/tor2web/errors CMD set -eux; \ nft -f /etc/nftables.conf; \ diff --git a/config/nginx.conf.template b/config/nginx.conf.template index 21e8a3dd32..bd7f1b9162 100644 --- a/config/nginx.conf.template +++ b/config/nginx.conf.template @@ -42,6 +42,10 @@ http { proxy_set_header Host $subdomain$pubkey.onion; proxy_set_header Accept-Encoding 'gzip, deflate'; proxy_redirect '~^(https?://([0-9a-z.-]+\.)?([2-7a-z]{16}|[2-7a-z]{56}))\.onion(.*)$' $1.${TOR2WEB_HOST}$4; + proxy_intercept_errors on; + error_page 451 /451.html; + error_page 500 502 503 504 /50x.html; + gzip on; gzip_proxied any; gzip_types text/plain text/html text/css text/javascript text/xml application/json application/xml; @@ -134,6 +138,14 @@ http { } } + location = /50x.html { + root /etc/tor2web/errors; + } + + location = /451.html { + root /etc/tor2web/errors; + } + location /robots.txt { root /var/www/html; } diff --git a/errors/451.html b/errors/451.html new file mode 100644 index 0000000000..714713b652 --- /dev/null +++ b/errors/451.html @@ -0,0 +1 @@ +Not found — abiko \ No newline at end of file diff --git a/errors/50x.html b/errors/50x.html new file mode 100644 index 0000000000..a134947128 --- /dev/null +++ b/errors/50x.html @@ -0,0 +1 @@ +Not found — abiko \ No newline at end of file