add tracking
This commit is contained in:
parent
550bdb2ba7
commit
f52b648c5b
|
@ -57,7 +57,7 @@
|
||||||
preserve_host: true
|
preserve_host: true
|
||||||
url: "http://accounts:3000"
|
url: "http://accounts:3000"
|
||||||
match:
|
match:
|
||||||
url: "http://oathkeeper:4455/<{user}>"
|
url: "http://oathkeeper:4455/<{user,user/**}>"
|
||||||
methods:
|
methods:
|
||||||
- GET
|
- GET
|
||||||
authenticators:
|
authenticators:
|
||||||
|
|
|
@ -291,6 +291,16 @@ server {
|
||||||
|
|
||||||
# proxy this call to siad endpoint (make sure the ip is correct)
|
# proxy this call to siad endpoint (make sure the ip is correct)
|
||||||
proxy_pass http://siad/skynet/skyfile/$dir1/$dir2/$dir3/$dir4$is_args$args;
|
proxy_pass http://siad/skynet/skyfile/$dir1/$dir2/$dir3/$dir4$is_args$args;
|
||||||
|
|
||||||
|
# register the upload in accounts service (cookies should contain jwt)
|
||||||
|
log_by_lua_block {
|
||||||
|
local skylink = ngx.header["Skynet-Skylink"]
|
||||||
|
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 }
|
||||||
|
end
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ "^/(([a-zA-Z0-9-_]{46}|[a-z0-9]{55})(/.*)?)$" {
|
location ~ "^/(([a-zA-Z0-9-_]{46}|[a-z0-9]{55})(/.*)?)$" {
|
||||||
|
@ -311,6 +321,16 @@ server {
|
||||||
# decoded whitespaces and set will re-encode it for us before passing it to proxy_pass
|
# decoded whitespaces and set will re-encode it for us before passing it to proxy_pass
|
||||||
set $skylink $1;
|
set $skylink $1;
|
||||||
|
|
||||||
|
# register the download in accounts service (cookies should contain jwt)
|
||||||
|
log_by_lua_block {
|
||||||
|
local skylink = ngx.var[2]
|
||||||
|
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 }
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
proxy_read_timeout 600;
|
proxy_read_timeout 600;
|
||||||
proxy_set_header User-Agent: Sia-Agent;
|
proxy_set_header User-Agent: Sia-Agent;
|
||||||
# proxy this call to siad /skynet/skylink/ endpoint (make sure the ip is correct)
|
# proxy this call to siad /skynet/skylink/ endpoint (make sure the ip is correct)
|
||||||
|
|
Reference in New Issue