drop 404 not found on hnsres error

This commit is contained in:
Karol Wypchlo 2020-09-16 17:06:09 +02:00
parent 936d4ecd0c
commit 8b88331065
1 changed files with 5 additions and 0 deletions

View File

@ -138,6 +138,11 @@ server {
local json = require('cjson')
local hns_domain_name, request_uri_rest = string.match(ngx.var.request_uri, "/hns/([^/?]+)(.*)")
local hnsres_res = ngx.location.capture("/hnsres/" .. hns_domain_name)
if hnsres_res.status ~= ngx.HTTP_OK then
ngx.exit(ngx.HTTP_NOT_FOUND)
end
local hnsres_json = json.decode(hnsres_res.body)
local skylink_prefix, skylink, skylink_rest = string.match(hnsres_json.skylink, "(sia://)([^/?]+)(.*)")