diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index 3c056a27..c766cb9e 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -334,6 +334,17 @@ server { # rewrite tus headers to use correct uri proxy_redirect https://siad/ https://$domain.$tld/; + + # extract skylink from base64 encoded upload metadata and assign to a proper header + header_filter_by_lua_block { + if ngx.header["Upload-Metadata"] then + local encodedSkylink = string.match(ngx.header["Upload-Metadata"], "Skylink ([^,?]+)") + + if encodedSkylink then + ngx.header["Skynet-Skylink"] = ngx.decode_base64(encodedSkylink) + end + end + } } location /skynet/pin { diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index 4fcea569..fe14b0a4 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -42,7 +42,7 @@ http { '"$http_user_agent" $upstream_response_time ' '$upstream_bytes_sent $upstream_bytes_received ' '"$upstream_http_content_type" "$upstream_cache_status" ' - '"$portal_domain" "$upstream_http_skynet_skylink" ' + '"$portal_domain" "$sent_http_skynet_skylink" ' '$upstream_connect_time $upstream_header_time ' '$request_time "$hns_domain"';