add more comments

This commit is contained in:
Karol Wypchlo 2020-09-16 14:37:14 +02:00
parent 54cda20b32
commit 936d4ecd0c
1 changed files with 6 additions and 2 deletions

View File

@ -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/([^/?]+)")