Merge pull request #839 from SkynetLabs/tus-skynet-skylink-header

add skynet-skylink header to tus final response
This commit is contained in:
Karol Wypchło 2021-06-09 14:56:53 +02:00 committed by GitHub
commit 80cc417445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -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 {

View File

@ -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"';