rewrite requests to workaround angular bracket issue

unescaped angular brackets aren't allowed, but used by gnupg. this
causes issues with Rocket that we can't fix in Hagrid. see
https://gitlab.com/sequoia-pgp/hagrid/issues/94

upstream rocket bug
https://github.com/SergioBenitez/Rocket/pull/941#issuecomment-492035708
This commit is contained in:
Vincent Breitmoser
2019-06-10 17:30:13 +02:00
parent 64c80a2d31
commit f19d5592be

View File

@@ -73,6 +73,18 @@ location /pks/lookup {
rewrite . /vks/v1/by-email/$email last;
}
# gpg --search '<address@example.org>'
# strip angle brackets - we don't need them, but they cause issues
# with the Rocket framework
# see https://gitlab.com/sequoia-pgp/hagrid/issues/94
if ($request_uri ~ "^/pks/lookup\?(.*)\<(.+)\>(.*)") {
set $left $1;
set $middle $2;
set $right $3;
set $args "";
rewrite . /pks/lookup?$left$middle$right? break;
}
# forward to backend, which will like serve via x-accel-redirect
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://127.0.0.1:8080;