add hty sudoer token chek
This commit is contained in:
+20
-2
@@ -25,6 +25,24 @@ while true do
|
||||
return
|
||||
end
|
||||
|
||||
local authorization = ngx.req.get_headers()["Authorization"]
|
||||
if authorization then
|
||||
ngx.log(ngx.INFO, 'Check request authorization Authorization -> ', ngx.req.get_headers().Authorization)
|
||||
else
|
||||
ngx.log(ngx.ERR, 'Request header no authorization ! ')
|
||||
ngx.status = 500
|
||||
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
|
||||
end
|
||||
|
||||
local authorization = ngx.req.get_headers()["HtySudoerToken"]
|
||||
if authorization then
|
||||
ngx.log(ngx.INFO, 'Check request authorization HtySudoerToken -> ', ngx.req.get_headers().HtySudoerToken)
|
||||
else
|
||||
ngx.log(ngx.ERR, 'Request header no hty sudoer token ! ')
|
||||
ngx.status = 500
|
||||
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
|
||||
end
|
||||
|
||||
if typ == "header" then
|
||||
|
||||
--"Content-Disposition","form-data; name=\"files[]\"; filename=\"Song-of-joy.png\""
|
||||
@@ -63,11 +81,11 @@ while true do
|
||||
local http = require "resty.http"
|
||||
local httpc = http.new()
|
||||
local remote_url = string.format("%s/api/v1/ts/create_task", task_server)
|
||||
|
||||
|
||||
ngx.log(ngx.INFO, 'remote_url -> ', remote_url)
|
||||
ngx.log(ngx.INFO, 'Authorization -> ', ngx.req.get_headers().Authorization)
|
||||
ngx.log(ngx.INFO, 'HtySudoerToken -> ', ngx.req.get_headers().HtySudoerToken)
|
||||
|
||||
|
||||
local body_text = cjson.encode({task_type = TaskTypes.UPLOAD_PICTURE, data = {images = files}})
|
||||
|
||||
ngx.log(ngx.INFO, 'UPLOAD_PICTURE *body_text* ->', body_text)
|
||||
|
||||
Reference in New Issue
Block a user