diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index 6c9ce836..fa047b70 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -130,8 +130,10 @@ server { location /hns { include /etc/nginx/conf.d/include/proxy-buffer; - set $skylink ''; - set $rest ''; + set $skylink ''; # placeholder for the raw 46 bit skylink + set $rest ''; # placeholder for the rest of the url that gets appended to skylink (path and args) + + # resolve handshake domain by requesting to /hnsres endpoint and assign correct values to $skylink and $rest access_by_lua_block { local json = require('cjson') local hns_domain_name, request_uri_rest = string.match(ngx.var.request_uri, "/hns/([^/?]+)(.*)") @@ -150,8 +152,10 @@ server { # overwrite the Cache-Control header to only cache for 60s in case the domain gets updated more_set_headers 'Cache-Control: public, max-age=60'; + # we proxy to another nginx location rather than directly to siad because we don't want to deal with caching here proxy_pass http://127.0.0.1/$skylink$rest; + # in case siad returns location header, we need to replace the skylink with the domain name header_filter_by_lua_block { if ngx.header.location then local hns_domain_name = string.match(ngx.var.request_uri, "/hns/([^/?]+)")