wkd: add nginx routes

This commit is contained in:
Vincent Breitmoser 2020-01-31 12:35:58 +01:00
parent deb3a0373b
commit 92cb32d36f
No known key found for this signature in database
GPG Key ID: 7BD18320DEADFA11
3 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,2 @@
<p><strong>Error 400</strong> Invalid request</p>
<p>See https://keys.openpgp.org/about/api</p>

1
dist/errors-static/404-wkd.htm vendored Normal file
View File

@ -0,0 +1 @@
No key found for this email address.

View File

@ -93,6 +93,34 @@ location /pks/lookup {
return 400;
}
# WKD requests
location /.well-known/openpgpkey {
etag off;
location ~ "^/.well-known/openpgpkey/([^/]+)/hu/([^/][^/])([^/][^/])(.*)" {
limit_req zone=search_email burst=50 nodelay;
error_page 429 /errors-static/429-rate-limit-vks-email.htm;
error_page 404 /errors-static/404-wkd.htm;
default_type application/pgp-keys;
add_header Content-Disposition 'attachment; filename="$2$3$4.asc"';
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Cache-Control' 'no-cache';
try_files /keys/links/wkd/$1/$2/$3/$4 =404;
}
location = /.well-known/openpgpkey/policy {
default_type text/plain;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Cache-Control' 'no-cache';
return 200 '';
}
add_header 'Access-Control-Allow-Origin' '*';
error_page 400 /errors-static/400-wkd-invalid.htm;
return 400;
}
location /pks/internal {
internal;