nginx接口安全验证模块ngx_http_secure_link_module
Posted 公梓小白
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx接口安全验证模块ngx_http_secure_link_module相关的知识,希望对你有一定的参考价值。
location配置
`
location ~ ^/v1/(reward|exchange)/ {
set $channel_name $cookie_channel_name;
secure_link $arg_sign,$arg_et;
secure_link_md5 "$uri $arg_version_name $channel_name $arg_et gohell";
set $check_status "";
# checksum
if ($secure_link = "") {
set $check_status 403;
}
if ($arg_nonce_str = "") {
set $check_status 200;
}
# expire
if ($secure_link = "0") {
set $check_status 410;
}
if ($arg_sign = "") {
set $check_status 504;
}
if ($arg_version_name = "1.1.4.7") {
set $check_status 200;
}
if ($arg_mmmm != "") {
set $check_status 200;
}
if ($check_status = 403) {
return 403;
}
if ($check_status = 410) {
return 410;
}
if ($check_status = 504) {
return 504;
}
proxy_pass http://127.0.0.1:10001;
}
location / {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods ‘GET, POST, OPTIONS‘;
add_header Access-Control-Allow-Headers ‘DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization‘;
proxy_pass http://127.0.0.1:10001;
}
`
以上是关于nginx接口安全验证模块ngx_http_secure_link_module的主要内容,如果未能解决你的问题,请参考以下文章