Generalize nginx rewrite rules.
This commit is contained in:
parent
3b9eb81908
commit
d34f9c7928
24
nginx.conf
24
nginx.conf
|
@ -23,13 +23,13 @@ http {
|
|||
}
|
||||
|
||||
location /by-fingerprint/ {
|
||||
rewrite ^/by-fingerprint/([^/][^/])(..*)$ $1/$2 break;
|
||||
rewrite ^/by-fingerprint/(0x)?([^/][^/])(..*)$ $2/$3 break;
|
||||
default_type application/pgp-keys;
|
||||
try_files /by-fpr/$uri =404;
|
||||
}
|
||||
|
||||
location /by-keyid/ {
|
||||
rewrite ^/by-keyid/([^/][^/])(.*)$ /by-keyid/$1/$2 break;
|
||||
rewrite ^/by-keyid/(0x)?([^/][^/])(.*)$ /by-keyid/$2/$3 break;
|
||||
default_type application/pgp-keys;
|
||||
try_files /$uri =404;
|
||||
}
|
||||
|
@ -37,24 +37,24 @@ http {
|
|||
# Common HKP requests.
|
||||
location /pks/lookup {
|
||||
# sq keyserver get <KEYID>, gpg --receive-keys <KEYID>
|
||||
if ($args ~* "^op=get&options=mr&search=0x([A-F0-9]{2})([A-F0-9]{14})$") {
|
||||
set $dir $1;
|
||||
set $file $2;
|
||||
if ($args ~* "^op=get&(options=mr&)?search=(0x)?([A-F0-9]{2})([A-F0-9]{14})$") {
|
||||
set $dir $3;
|
||||
set $file $4;
|
||||
rewrite . /by-keyid/$dir/$file;
|
||||
}
|
||||
|
||||
# gpg --receive-keys <FINGERPRINT>
|
||||
if ($args ~* "^op=get&options=mr&search=0x([A-F0-9]{2})([A-F0-9]{38})$") {
|
||||
set $dir $1;
|
||||
set $file $2;
|
||||
if ($args ~* "^op=get&(options=mr&)?search=(0x)?([A-F0-9]{2})([A-F0-9]{38})$") {
|
||||
set $dir $3;
|
||||
set $file $4;
|
||||
rewrite . /by-fingerprint/$dir/$file;
|
||||
}
|
||||
|
||||
# gpg --locate-key <EMAIL>
|
||||
if ($args ~* "^op=get&options=mr&search=(..)([^&]*)@([^&]*)") {
|
||||
set $dir $1;
|
||||
set $local $2;
|
||||
set $horst $3;
|
||||
if ($args ~* "^op=get&(options=mr&)?search=(..)([^&]*)@([^&]*)") {
|
||||
set $dir $2;
|
||||
set $local $3;
|
||||
set $horst $4;
|
||||
rewrite . /by-email/$dir/$local%40$horst;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue