update
Browse files
app.lua
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
local uri = ngx.var.uri
|
| 2 |
ngx.say("uri: ", uri)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
ngx.say('\n\n\n')
|
| 4 |
|
| 5 |
|
|
|
|
| 1 |
+
-- 这是一个单行注释
|
| 2 |
+
|
| 3 |
+
--[[
|
| 4 |
+
这是一个多行注释
|
| 5 |
+
这是一个多行注释
|
| 6 |
+
]]
|
| 7 |
local uri = ngx.var.uri
|
| 8 |
ngx.say("uri: ", uri)
|
| 9 |
+
|
| 10 |
+
local api_version = ''
|
| 11 |
+
local api_pxoxy_pass_url_indicator = ''
|
| 12 |
+
|
| 13 |
+
-- 提取版本号和 proxy_pass url 标识
|
| 14 |
+
local version_match = string.match(uri, "^/(v%d+)/(.*)")
|
| 15 |
+
if version_match then
|
| 16 |
+
api_version = version_match[1]
|
| 17 |
+
api_pxoxy_pass_url_indicator = version_match[2]
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
ngx.say("api_version: ", api_version)
|
| 21 |
+
ngx.say("api_pxoxy_pass_url_indicator: ", api_pxoxy_pass_url_indicator)
|
| 22 |
+
|
| 23 |
ngx.say('\n\n\n')
|
| 24 |
|
| 25 |
|
方案.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
# URI 分段说明
|
| 2 |
-
分段:/{
|
| 3 |
-
说明:
|
| 4 |
|
| 5 |
#
|
|
|
|
| 1 |
# URI 分段说明
|
| 2 |
+
分段:/{api_version}/{api_pxoxy_pass_url_indicator}
|
| 3 |
+
说明:api_version —— 版本,不可省略; api_pxoxy_pass_url_indicator —— 代理跳过url标识,不可省略
|
| 4 |
|
| 5 |
#
|