This commit is contained in:
2021-11-28 14:46:40 +08:00
parent 6e4207617a
commit d487c59c01
2 changed files with 10 additions and 18 deletions
+2 -8
View File
@@ -34,11 +34,7 @@
# resty.index
# site
server {
# set $servername "music-room.alchemy-studio.cn";
set $servername "test.localhost"; # set in your /etc/hosts
# server_name $servername;
server_name "test.localhost";
# listen 443 ssl;
listen 8088;
# disable in local test env
@@ -51,9 +47,7 @@ server {
set $tmp_file_dir "/usr/local/file_upload"; # 文件存储路径
set $task_server "https://127.0.0.1:8080"; # task server host
set $htyuc "http://127.0.0.1:8088"; #htyuc host
#set $resty_loc "/usr/local/openresty";
set $resty_loc "/usr/local/opt/openresty"; # MacOS
set $convert "/usr/local/bin/convert";
@@ -89,11 +83,11 @@ server {
location /api/v1/ws/ {
proxy_pass http://127.0.0.1:3001/api/v1/ws/;
proxy_set_header Host $host;
proxy_set_header Host $host;
}
location /api/v1/uc/ {
proxy_pass http://127.0.0.1:3000/api/v1/uc/;
proxy_set_header Host $host;
proxy_set_header Host $host;
}
location /api/v1/ts/ {
proxy_pass http://127.0.0.1:8080/api/v1/ts/;
+8 -10
View File
@@ -77,16 +77,16 @@ local function verifyJwtToken(encrypted_token)
if not res then
ngx.status = ngx.HTTP_UNAUTHORIZED
ngx.header.content_type = "application/json; charset=utf-8"
ngx.log(ngx.ERR, "Jwt token verify request error ! ")
ngx.log(ngx.ERR, "CAN'T VERIFY JWT TOKEN!")
ngx.exit(ngx.HTTP_UNAUTHORIZED)
else
if 200 ~= res.status then
ngx.log(ngx.ERR, "Jwt token verify error ! ", err)
ngx.log(ngx.ERR, "JWT TOKEN VERIFICATION ERROR!", err)
ngx.exit(res.status)
end
end
ngx.log(ngx.INFO, "Jwt token verify ok .")
ngx.log(ngx.INFO, "JWT TOKEN VERIFICATION PASSED.")
end
@@ -102,15 +102,14 @@ local function decodeJwtToken(encrypted_token)
end
ngx.log(ngx.INFO, "JWT: " .. cjson.encode(jwt_obj))
ngx.log(ngx.INFO, "jwt object : payload : sub " .. jwt_obj.payload.sub)
local htytoken = cjson.decode(jwt_obj.payload.sub)
ngx.log(ngx.INFO, "htytoken : token_id " .. htytoken.token_id)
ngx.log(ngx.INFO, "htytoken : hty_id " .. htytoken.hty_id)
ngx.log(ngx.INFO, "htytoken : app_id " .. htytoken.app_id)
ngx.log(ngx.INFO, "htytoken : ts " .. htytoken.ts)
ngx.log(ngx.INFO, "htytoken : roles " .. htytoken.roles)
ngx.log(ngx.INFO, "HTY_TOKEN : token_id " .. htytoken.token_id)
ngx.log(ngx.INFO, "HTY_TOKEN : hty_id " .. htytoken.hty_id)
ngx.log(ngx.INFO, "HTY_TOKEN : app_id " .. htytoken.app_id)
ngx.log(ngx.INFO, "HTY_TOKEN : ts " .. htytoken.ts)
ngx.log(ngx.INFO, "HTY_TOKEN : roles " .. htytoken.roles)
return htytoken
end
@@ -150,7 +149,6 @@ while true do
--end
if type == "header" then
--"Content-Disposition","form-data; name=\"files[]\"; filename=\"Song-of-joy.png\""
--"Content-Type","image\/png"
local key = res[1]