Skip to content

Commit

Permalink
Add error pages
Browse files Browse the repository at this point in the history
  • Loading branch information
dannote committed Apr 5, 2021
1 parent b3762aa commit ab3c6ee
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down
12 changes: 12 additions & 0 deletions config/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions errors/451.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Not found — abiko</title><link href="https://abiko.me/images/icon.png" rel="icon" type="image/png" /><meta content="width=device-width, initial-scale=1" name="viewport" /><link href="https://abiko.me/stylesheets/style.css" media="all" rel="stylesheet" type="text/css" /></head><body class="layout layout_centered"><form action="https://abiko.me/search" class="search-box"><div class="search-box__logo"><svg viewBox="0 0 160 52" width="160" height="52" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="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M88.4 10.7c-.3.6-.8 1-1.6 1.3-.9.2-2 .4-3.3.4-1.4 0-2.5-.2-3.3-.4-.8-.3-1.4-.7-1.7-1.4L78 9a18.8 18.8 0 010-4.4l.6-1.7c.6-1.2 2.3-1.7 5-1.7s4.4.5 5 1.7l.6 1.7A18.8 18.8 0 0189 9c-.1.5-.3 1-.7 1.7z" fill="#4c9846" fill-rule="nonzero"/><path d="M114.4 34s8.5 6.7 9.8 8.3c.5.7 3 3.7 0 7-3.5 3.8-7.8.3-9.2-.6-1.5-1-2.4-1.8-4.6-4-2.2-1.8-3.6-3.4-4.7-4.2v5l-.1 2.1c0 .6-.3 1.1-.7 1.8-.5 1-2.2 1.7-5 1.7-2.7 0-4.3-.6-5-1.8-.2-.6-.4-1.2-.4-1.7l-.2-2.2V6.6l.2-2.2c0-.5.2-1 .5-1.7.6-1.2 2.2-1.8 5-1.8 2.1 0 3.6.4 4.4 1.1.7.6 1.1 1.6 1.2 2.9v22.3l3.6-3.3c1.6-1.6 3-3.1 4.3-4.1.4-.4 1.6-1.6 4-2 1.7-.4 3.7.2 5.2 2 1.4 1.7 1 3.1 1 4 0 1-1.3 3.4-3 4.8l-6.3 5.4zM125.6 34c0-5 1.8-9 5.3-12.3a17.2 17.2 0 0124 0c3.4 3.2 5.1 7.3 5.1 12.3a17.2 17.2 0 01-31.7 9 15.2 15.2 0 01-2.7-9zm13.1 4.5c1.3 1 2.7 1.5 4 1.5 1.4 0 2.8-.5 4.2-1.5 1.4-1.1 2-2.6 2-4.6 0-2-.6-3.6-1.9-4.6a6.5 6.5 0 00-8.4 0c-1.3 1.1-1.9 2.6-1.9 4.6 0 2 .7 3.6 2 4.6z" fill="#9150af" fill-rule="nonzero"/></svg></div><div class="search-box__input input input_with-button"><input autocomplete="off" autofocus="" class="input__input" maxlength="256" name="q" spellcheck="false" title="Query" type="text" /><button aria-label="Search" class="input__button input__button_search"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 57 57" width="16" height="16"><path d="M55 52L41.7 37.7C45 33.7 47 28.4 47 23 47 10.3 36.7 0 24 0S1 10.3 1 23s10.3 23 23 23c4.7 0 9.3-1.4 13.2-4.2L50.8 56c.6.6 1.4 1 2.2 1 .8 0 1.5-.3 2-1 1.3-1 1.3-3 0-4zM24 6c9.4 0 17 7.6 17 17s-7.6 17-17 17S7 32.4 7 23 14.6 6 24 6z"/></svg></button></div><div class="search-box__inscription">The hidden service is blocked,<br/>but we can find something else.</div></form></body></html>
1 change: 1 addition & 0 deletions errors/50x.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Not found — abiko</title><link href="https://abiko.me/images/icon.png" rel="icon" type="image/png" /><meta content="width=device-width, initial-scale=1" name="viewport" /><link href="https://abiko.me/stylesheets/style.css" media="all" rel="stylesheet" type="text/css" /></head><body class="layout layout_centered"><form action="https://abiko.me/search" class="search-box"><div class="search-box__logo"><svg viewBox="0 0 160 52" width="160" height="52" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M23.1 20.6c.3-2.4 2-3.6 5.1-3.6 1.7 0 3 .1 3.8.4.8.2 1.4.7 1.7 1.3l.6 1.7v27.1c0 .5-.3 1.1-.6 1.8-.6 1-2 1.6-4.4 1.6-2.4 0-4-.3-4.7-.9a3.4 3.4 0 01-1.4-2.5c-1.7 2.3-4.3 3.4-8 3.4a14 14 0 01-10.4-5 17 17 0 010-23.8c3.2-3.4 6.8-5 10.6-5 1.5 0 2.8.2 4 .7 1.2.5 2 1 2.5 1.4l1.2 1.4zM11.3 34c0 1.4.6 2.7 1.7 3.8a5.4 5.4 0 004 1.7c1.7 0 3-.6 4-1.7 1.1-1.2 1.6-2.5 1.6-4 0-1.3-.5-2.6-1.4-3.8a5 5 0 00-4.1-1.8 5 5 0 00-4.2 1.8 5.8 5.8 0 00-1.6 4zM58.2 17c3.8 0 7.4 1.7 10.6 5.1a17 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1.1 1.6 1.2 2.9v22.3l3.6-3.3c1.6-1.6 3-3.1 4.3-4.1.4-.4 1.6-1.6 4-2 1.7-.4 3.7.2 5.2 2 1.4 1.7 1 3.1 1 4 0 1-1.3 3.4-3 4.8l-6.3 5.4zM125.6 34c0-5 1.8-9 5.3-12.3a17.2 17.2 0 0124 0c3.4 3.2 5.1 7.3 5.1 12.3a17.2 17.2 0 01-31.7 9 15.2 15.2 0 01-2.7-9zm13.1 4.5c1.3 1 2.7 1.5 4 1.5 1.4 0 2.8-.5 4.2-1.5 1.4-1.1 2-2.6 2-4.6 0-2-.6-3.6-1.9-4.6a6.5 6.5 0 00-8.4 0c-1.3 1.1-1.9 2.6-1.9 4.6 0 2 .7 3.6 2 4.6z" fill="#9150af" fill-rule="nonzero"/></svg></div><div class="search-box__input input input_with-button"><input autocomplete="off" autofocus="" class="input__input" maxlength="256" name="q" spellcheck="false" title="Query" type="text" /><button aria-label="Search" class="input__button input__button_search"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 57 57" width="16" height="16"><path d="M55 52L41.7 37.7C45 33.7 47 28.4 47 23 47 10.3 36.7 0 24 0S1 10.3 1 23s10.3 23 23 23c4.7 0 9.3-1.4 13.2-4.2L50.8 56c.6.6 1.4 1 2.2 1 .8 0 1.5-.3 2-1 1.3-1 1.3-3 0-4zM24 6c9.4 0 17 7.6 17 17s-7.6 17-17 17S7 32.4 7 23 14.6 6 24 6z"/></svg></button></div><div class="search-box__inscription">The hidden service is unavailable,<br/>but we can find something else.</div></form></body></html>

0 comments on commit ab3c6ee

Please sign in to comment.