add more comments
This commit is contained in:
parent
54cda20b32
commit
936d4ecd0c
|
@ -130,8 +130,10 @@ server {
|
||||||
location /hns {
|
location /hns {
|
||||||
include /etc/nginx/conf.d/include/proxy-buffer;
|
include /etc/nginx/conf.d/include/proxy-buffer;
|
||||||
|
|
||||||
set $skylink '';
|
set $skylink ''; # placeholder for the raw 46 bit skylink
|
||||||
set $rest '';
|
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 {
|
access_by_lua_block {
|
||||||
local json = require('cjson')
|
local json = require('cjson')
|
||||||
local hns_domain_name, request_uri_rest = string.match(ngx.var.request_uri, "/hns/([^/?]+)(.*)")
|
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
|
# 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';
|
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;
|
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 {
|
header_filter_by_lua_block {
|
||||||
if ngx.header.location then
|
if ngx.header.location then
|
||||||
local hns_domain_name = string.match(ngx.var.request_uri, "/hns/([^/?]+)")
|
local hns_domain_name = string.match(ngx.var.request_uri, "/hns/([^/?]+)")
|
||||||
|
|
Reference in New Issue