Update README.md (#12)

This commit is contained in:
XiaoLi
2021-09-04 17:49:51 +08:00
committed by GitHub
parent 56a03f3cf0
commit d1253478a7
+34 -3
View File
@@ -227,9 +227,40 @@ location /image_append {
# server contex 中添加location
#Donwload image use ngx.exec
location /download_image2 {
content_by_lua_file /usr/local/openresty/nginx/conf/lua/download_image2.lua;
#Donwload image use ngx.req.set_uri
location /download_image {
rewrite_by_lua_block {
ngx.log(ngx.INFO , "location /download_image")
-- TODO: jwt decoder
--
-- Functions : String split
string.split = function(s, p)
local rt= {}
string.gsub(s, '[^'..p..']+', function(w) table.insert(rt, w) end )
return rt
end
-- Get url and split by '/' save into a table
local sub_url_table = string.split(ngx.var.uri, '/')
local sub_url_number = table.getn(sub_url_table)
for i = 1, sub_url_number do
ngx.log(ngx.INFO , "Sub url sub" .. i .. " : " .. sub_url_table[i])
end
local uri = "/internal_file_upload/"..sub_url_table[sub_url_number]..".jpg"
ngx.log(ngx.INFO , "uri : " .. uri)
return ngx.req.set_uri(uri , true)
}
}
#Static file server
location /internal_file_upload {
internal;
try_files $uri /file_upload/8493acab-0f7a-47e0-8fff-e96b843334dd.jpg;
}
```