From dc21777aa4536eca5135bb41dfacd6ebe3fef5b9 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 5 Feb 2021 16:11:43 +0100 Subject: [PATCH] add logging to tracking --- docker/nginx/conf.d/client.conf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker/nginx/conf.d/client.conf b/docker/nginx/conf.d/client.conf index 917c9955..476ea2a1 100644 --- a/docker/nginx/conf.d/client.conf +++ b/docker/nginx/conf.d/client.conf @@ -316,7 +316,10 @@ server { if skylink and ngx.status >= ngx.HTTP_OK and ngx.status < ngx.HTTP_SPECIAL_RESPONSE then local http = require("socket.http") 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 } } @@ -345,7 +348,10 @@ server { if skylink and ngx.status >= ngx.HTTP_OK and ngx.status < ngx.HTTP_SPECIAL_RESPONSE then local http = require("socket.http") 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 }