nginx: fix hkp routes
Changes handling of hkp routes: - uri decode the search paramter before passing to /pks/internal/$op/$query - strip <> surrounded text in lua, instead of an nginx rule
This commit is contained in:
parent
8805cb7790
commit
52e863281d
|
@ -74,14 +74,13 @@ location /vks/v1/ {
|
|||
|
||||
# Common HKP requests.
|
||||
location /pks/lookup {
|
||||
# if the search argument contains angle brackets, strip everything around them
|
||||
if ($arg_search ~ ".*\<([^&<>]+)\>.*") {
|
||||
set $arg_search "$1";
|
||||
}
|
||||
|
||||
# rewrite this to a path we can match on (right below)
|
||||
if ($args ~ "op=.*search=") {
|
||||
rewrite . /pks/internal/$arg_op/$arg_search last;
|
||||
# urldecode the search parameter
|
||||
set_by_lua $arg_search_decoded "return ngx.arg[1]:gsub(\"%%(%x%x)\", function(x) return string.char(tonumber(x, 16)) end)" $arg_search;
|
||||
# if the search argument contains angle brackets, strip everything around them
|
||||
set_by_lua $arg_search_decoded "return ngx.arg[1]:gsub(\"^.*<([^>]-)>.*$\", \"%1\")" $arg_search_decoded;
|
||||
rewrite . /pks/internal/$arg_op/$arg_search_decoded last;
|
||||
}
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
|
|
Loading…
Reference in New Issue