add logging to tracking

This commit is contained in:
Karol Wypchlo 2021-02-05 16:11:43 +01:00
parent bc80a358d8
commit dc21777aa4
1 changed files with 8 additions and 2 deletions

View File

@ -316,7 +316,10 @@ server {
if skylink and ngx.status >= ngx.HTTP_OK and ngx.status < ngx.HTTP_SPECIAL_RESPONSE then if skylink and ngx.status >= ngx.HTTP_OK and ngx.status < ngx.HTTP_SPECIAL_RESPONSE then
local http = require("socket.http") local http = require("socket.http")
local headers = { Cookie = ngx.req.get_headers()["Cookie"] } local headers = { Cookie = ngx.req.get_headers()["Cookie"] }
http.request { url = "http://accounts:3000/track/upload/" .. skylink, method = "POST", headers = headers } local ok, statusCode, headers, statusText = http.request { url = "http://accounts:3000/track/upload/" .. skylink, method = "POST", headers = headers }
if statusCode ~= ngx.HTTP_NO_CONTENT then
ngx.log(ngx.ERR, "accounts endpoint /track/upload/" .. skylink .. " failed with error " .. statusCode)
end
end end
} }
} }
@ -345,7 +348,10 @@ server {
if skylink and ngx.status >= ngx.HTTP_OK and ngx.status < ngx.HTTP_SPECIAL_RESPONSE then if skylink and ngx.status >= ngx.HTTP_OK and ngx.status < ngx.HTTP_SPECIAL_RESPONSE then
local http = require("socket.http") local http = require("socket.http")
local headers = { Cookie = ngx.req.get_headers()["Cookie"] } local headers = { Cookie = ngx.req.get_headers()["Cookie"] }
http.request { url = "http://accounts:3000/track/download/" .. skylink, method = "POST", headers = headers } local ok, statusCode, headers, statusText = http.request { url = "http://accounts:3000/track/download/" .. skylink, method = "POST", headers = headers }
if statusCode ~= ngx.HTTP_NO_CONTENT then
ngx.log(ngx.ERR, "accounts endpoint /track/download/" .. skylink .. " failed with error " .. statusCode)
end
end end
} }