在访问处理程序中创建的nginx变量不';在后续指令中使用时不包含值
我已经为nginx编写了一个模块,它在访问阶段注册。模块解码并验证它接收到的令牌,并存储正在进行身份验证的用户的值(在令牌中编码),该值由我为变量定义的变量get函数提供。但是,在location块中后续使用变量时不会返回该值。在对该位置的下一个HTTP请求中,返回来自上一个请求的值。它总是以1为单位不同步-当前请求返回上一个HTTP请求的名称 以下是我的nginx.conf的相关部分:在访问处理程序中创建的nginx变量不';在后续指令中使用时不包含值,nginx,Nginx,我已经为nginx编写了一个模块,它在访问阶段注册。模块解码并验证它接收到的令牌,并存储正在进行身份验证的用户的值(在令牌中编码),该值由我为变量定义的变量get函数提供。但是,在location块中后续使用变量时不会返回该值。在对该位置的下一个HTTP请求中,返回来自上一个请求的值。它总是以1为单位不同步-当前请求返回上一个HTTP请求的名称 以下是我的nginx.conf的相关部分: location /introspect {
location /introspect {
set_form_input $token token; # parse the request body
# decode the token, and if valid save user name
jwt_decode aud=$aud token=$token;
# $jwt_user is defined by the module and returns the saved user name
set $whoami $jwt_user;
try_files $uri @success;
}
location @success {
return 200 '{"active" : true, "user" : "$whoami"}';
}
你知道会出什么问题吗