Nginx passes Skynet-Api-Key and Authorization headers at all spots where it passes the Cookie header.
This commit is contained in:
parent
061770a95a
commit
2db648b0ad
|
@ -11,7 +11,11 @@ log_by_lua_block {
|
|||
-- 10.10.10.70 points to accounts service (alias not available when using resty-http)
|
||||
local res, err = httpc:request_uri("http://10.10.10.70:3000/track/download/" .. skylink .. "?" .. query, {
|
||||
method = "POST",
|
||||
headers = { ["Cookie"] = "skynet-jwt=" .. jwt },
|
||||
headers = {
|
||||
["Cookie"] = "skynet-jwt=" .. jwt,
|
||||
["Authorization"] = ngx.header["Authorization"],
|
||||
["Skynet-Api-Key"] = ngx.header["Skynet-Api-Key"],
|
||||
},
|
||||
})
|
||||
|
||||
if err or (res and res.status ~= ngx.HTTP_NO_CONTENT) then
|
||||
|
|
|
@ -14,7 +14,11 @@ log_by_lua_block {
|
|||
-- 10.10.10.70 points to accounts service (alias not available when using resty-http)
|
||||
local res, err = httpc:request_uri("http://10.10.10.70:3000/track/registry/" .. registry_action, {
|
||||
method = "POST",
|
||||
headers = { ["Cookie"] = "skynet-jwt=" .. jwt },
|
||||
headers = {
|
||||
["Cookie"] = "skynet-jwt=" .. jwt,
|
||||
["Authorization"] = ngx.header["Authorization"],
|
||||
["Skynet-Api-Key"] = ngx.header["Skynet-Api-Key"],
|
||||
},
|
||||
})
|
||||
|
||||
if err or (res and res.status ~= ngx.HTTP_NO_CONTENT) then
|
||||
|
|
|
@ -10,7 +10,11 @@ log_by_lua_block {
|
|||
-- 10.10.10.70 points to accounts service (alias not available when using resty-http)
|
||||
local res, err = httpc:request_uri("http://10.10.10.70:3000/track/upload/" .. skylink, {
|
||||
method = "POST",
|
||||
headers = { ["Cookie"] = "skynet-jwt=" .. jwt },
|
||||
headers = {
|
||||
["Cookie"] = "skynet-jwt=" .. jwt,
|
||||
["Authorization"] = ngx.header["Authorization"],
|
||||
["Skynet-Api-Key"] = ngx.header["Skynet-Api-Key"],
|
||||
},
|
||||
})
|
||||
|
||||
if err or (res and res.status ~= ngx.HTTP_NO_CONTENT) then
|
||||
|
|
|
@ -178,7 +178,11 @@ location /skynet/registry/subscription {
|
|||
|
||||
-- fetch account limits and set download bandwidth and registry delays accordingly
|
||||
local res, err = httpc:request_uri("http://10.10.10.70:3000/user/limits", {
|
||||
headers = { ["Cookie"] = "skynet-jwt=" .. ngx.var.skynet_jwt }
|
||||
headers = {
|
||||
["Cookie"] = "skynet-jwt=" .. ngx.var.skynet_jwt,
|
||||
["Authorization"] = ngx.header["Authorization"],
|
||||
["Skynet-Api-Key"] = ngx.header["Skynet-Api-Key"],
|
||||
}
|
||||
})
|
||||
|
||||
-- fail gracefully in case /user/limits failed
|
||||
|
|
|
@ -46,7 +46,11 @@ function _M.get_account_limits()
|
|||
|
||||
-- 10.10.10.70 points to accounts service (alias not available when using resty-http)
|
||||
local res, err = httpc:request_uri("http://10.10.10.70:3000/user/limits", {
|
||||
headers = { ["Cookie"] = "skynet-jwt=" .. ngx.var.skynet_jwt }
|
||||
headers = {
|
||||
["Cookie"] = "skynet-jwt=" .. ngx.var.skynet_jwt,
|
||||
["Authorization"] = ngx.header["Authorization"],
|
||||
["Skynet-Api-Key"] = ngx.header["Skynet-Api-Key"],
|
||||
}
|
||||
})
|
||||
|
||||
-- fail gracefully in case /user/limits failed
|
||||
|
|
Reference in New Issue