跨站问题处理和对系统状态码进行简单测试
This commit is contained in:
parent
7ab44b198e
commit
e4eef5f4b8
|
|
@ -56,9 +56,9 @@ http {
|
||||||
access_by_lua_block {
|
access_by_lua_block {
|
||||||
ngx.header["Access-Control-Allow-Origin"] = "*";
|
ngx.header["Access-Control-Allow-Origin"] = "*";
|
||||||
ngx.header["Access-Control-Allow-Methods"] = "GET, POST, DELETE, PUT";
|
ngx.header["Access-Control-Allow-Methods"] = "GET, POST, DELETE, PUT";
|
||||||
ngx.header["Access-Control-Allow-Headers"] = "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization";
|
ngx.header["Access-Control-Allow-Headers"] = "*";
|
||||||
ngx.header["Access-Control-Max-Age"] = 1728000;
|
ngx.header["Access-Control-Max-Age"] = 1728000;
|
||||||
ngx.header["Access-Control-Expose-Headers"] = "Content-Length,Content-Range";
|
ngx.header["Access-Control-Expose-Headers"] = "*";
|
||||||
if ngx.var.request_method == "OPTIONS" then
|
if ngx.var.request_method == "OPTIONS" then
|
||||||
ngx.status = 204
|
ngx.status = 204
|
||||||
ngx.exit(ngx.OK)
|
ngx.exit(ngx.OK)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,18 @@ local id = snow:generateUniqueId()-- 生成ID
|
||||||
|
|
||||||
--max =a and b or c--a?b:c
|
--max =a and b or c--a?b:c
|
||||||
|
|
||||||
|
local STATUS_CODE = {
|
||||||
|
-- 成功状态码
|
||||||
|
SUCCESS = { code = 200, message = "操作成功" },
|
||||||
|
UNKNOWN_ERROR = { code = 9999, message = "未知错误" }
|
||||||
|
}
|
||||||
|
|
||||||
|
local val = STATUS_CODE.SUCCESS
|
||||||
|
local status = val or STATUS_CODE.UNKNOWN_ERROR
|
||||||
|
local msg = status.message
|
||||||
|
ngx.say("message:"..msg)
|
||||||
|
|
||||||
|
|
||||||
--local openssl = require("openssl")
|
--local openssl = require("openssl")
|
||||||
--
|
--
|
||||||
---- 生成RSA密钥对
|
---- 生成RSA密钥对
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user