diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index f2a35c8b..7ea0c288 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -159,9 +159,7 @@ server { if skylink == nil then skylink, skylink_rest = string.match(hnsres_json.skylink, "/?([^/?]+)(.*)") end - end - - if hnsres_json.registry then + elseif hnsres_json.registry then local publickey = hnsres_json.registry.publickey local datakey = hnsres_json.registry.datakey @@ -183,6 +181,11 @@ server { skylink = data end + -- fail with a generic 404 if skylink has not been extracted from a valid /hnsres response for some reason + if not skylink then + ngx.exit(ngx.HTTP_NOT_FOUND) + end + ngx.var.skylink = skylink if request_uri_rest == "/" and skylink_rest ~= "" and skylink_rest ~= "/" then ngx.var.rest = skylink_rest