You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/03/18 11:04:52 UTC

[GitHub] [incubator-apisix] lilien1010 opened a new issue #1297: bug: jwt plugin make the request http StatusCode= 500

lilien1010 opened a new issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297
 
 
   ### Issue description
   
   ![image](https://user-images.githubusercontent.com/3814966/76954260-05dc2a80-694b-11ea-9530-897d6618c772.png)
    
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601116299
 
 
   @liujianri comment in english next time

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] liujianri edited a comment on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
liujianri edited a comment on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601060640
 
 
   这个问题 是因为在resty.jwt.lua 中取header中的alg时,是header.alg 这样取出来的,仔细看生成的jwt token 就能发现,生成jwt token 中的header 部分 header.alg 是nil的,注意是区分大小写的哦。
   正确的应该是 :
   `{
     "alg": "HS256",
     "typ": "JWT"
   }`
   错误的:
   `{
     "Alg": "HS256",
     "Typ": "JWT"
   }`
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601124147
 
 
   @chenqing24 your bug has been fixed, please use the lastest Apache APISIX (master branch)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601243358
 
 
   @membphis  this issue will be close,since it's the Backend capital issue

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] liujianri edited a comment on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
liujianri edited a comment on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601060640
 
 
   这个问题 是因为在resty.jwt.lua 中取header中的alg时,是header.alg 这样取出来的,问题就出在传入的jwt token的header 部分,出现这个问题的时候检查一下jwt token 的header部分 看看header.alg 是不是nil,注意这个里面的key是区分大小写的哦。
   正确的应该是 :
   `{
     "alg": "HS256",
     "typ": "JWT"
   }`
   错误的:
   `{
     "Alg": "HS256",
     "Typ": "JWT"
   }`
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] chenqing24 commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
chenqing24 commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601115515
 
 
   发生类似情况:
   背景:基于apisix做了一个权限网关,用户登入时,会请求生成jwt token。
   问题:一开始用都正常,在用测试账号反复登入时,出现异常,反馈码500
   模拟请求:`curl --location --request GET 'http://gateway.itcjf.com/apisix/plugin/jwt/sign?key=cq39882`
   error log:```
   2020/03/18 17:37:32 [error] 2265479#2265479: *288045272 lua entry thread aborted: runtime error: /usr/share/lua/5.1/apisix/lua/apisix/consumer.lua:38: attempt to index local 'consumer' (a boolean value)
   stack traceback:
   coroutine 0:
   /usr/share/lua/5.1/apisix/lua/apisix/consumer.lua: in function 'create_obj_fun'
   /usr/share/lua/5.1/apisix/lua/apisix/core/lrucache.lua:64: in function 'global'
   /usr/share/lua/5.1/apisix/lua/apisix/consumer.lua:64: in function 'plugin'
   /usr/share/lua/5.1/apisix/lua/apisix/plugins/jwt-auth.lua:174: in function 'handler'
   /usr/share/lua/5.1/apisix/lua/apisix/plugin.lua:213: in function 'handler'
   /usr/share/lua/5.1/resty/radixtree.lua:627: in function 'dispatch'
   .../lua/5.1/apisix/lua/apisix/http/router/radixtree_uri.lua:110: in function 'match'
   /usr/share/lua/5.1/apisix/lua/apisix.lua:264: in function 'http_access_phase'
   access_by_lua(nginx.conf:146):2: in main chunk, client: 10.10.150.6, server: , request: "GET /apisix/plugin/jwt/sign?key=cq39882 HTTP/1.1", host: "gateway.itcjf.com"
   ```
   重启apisix后,故障消失。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] chenqing24 edited a comment on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
chenqing24 edited a comment on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601115515
 
 
   发生类似情况:
   背景:基于apisix做了一个权限网关,用户登入时,会请求生成jwt token。
   问题:一开始用都正常,在用测试账号反复登入时,出现异常,反馈码500
   模拟请求:`curl --location --request GET 'http://gateway.itcjf.com/apisix/plugin/jwt/sign?key=cq39882`
   error log:
   ```
   2020/03/18 17:37:32 [error] 2265479#2265479: *288045272 lua entry thread aborted: runtime error: /usr/share/lua/5.1/apisix/lua/apisix/consumer.lua:38: attempt to index local 'consumer' (a boolean value)
   stack traceback:
   coroutine 0:
   /usr/share/lua/5.1/apisix/lua/apisix/consumer.lua: in function 'create_obj_fun'
   /usr/share/lua/5.1/apisix/lua/apisix/core/lrucache.lua:64: in function 'global'
   /usr/share/lua/5.1/apisix/lua/apisix/consumer.lua:64: in function 'plugin'
   /usr/share/lua/5.1/apisix/lua/apisix/plugins/jwt-auth.lua:174: in function 'handler'
   /usr/share/lua/5.1/apisix/lua/apisix/plugin.lua:213: in function 'handler'
   /usr/share/lua/5.1/resty/radixtree.lua:627: in function 'dispatch'
   .../lua/5.1/apisix/lua/apisix/http/router/radixtree_uri.lua:110: in function 'match'
   /usr/share/lua/5.1/apisix/lua/apisix.lua:264: in function 'http_access_phase'
   access_by_lua(nginx.conf:146):2: in main chunk, client: 10.10.150.6, server: , request: "GET /apisix/plugin/jwt/sign?key=cq39882 HTTP/1.1", host: "gateway.itcjf.com"
   ```
   重启apisix后,故障消失。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] liujianri edited a comment on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
liujianri edited a comment on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601060640
 
 
   这个问题 是因为在resty.jwt.lua 中取header中的alg时,是header.alg 这样取出来的,问题就出在传入的jwt token的header 部分,出现这个问题的时候检查一下jwt token 的header部分 看看header.alg 是不是nil,注意这个你们的key是区分大小写的哦。
   正确的应该是 :
   `{
     "alg": "HS256",
     "typ": "JWT"
   }`
   错误的:
   `{
     "Alg": "HS256",
     "Typ": "JWT"
   }`
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 closed issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
lilien1010 closed issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] liujianri commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
liujianri commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-601060640
 
 
   这个问题 是因为在resty.jwt.lua 中取header中的alg时,是header.alg 这样取出来的,仔细看生成的jwt token 就能发现,生成jwt token 中的header 部分 header.alg 是nil的,注意是区分大小写的哦。
   正确的应该是 :
   `{
     "alg": "HS256",
     "typ": "JWT"
   }`
   错误的:
   {
     "Alg": "HS256",
     "Typ": "JWT"
   }
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on issue #1297: bug: jwt plugin make the request http StatusCode= 500
URL: https://github.com/apache/incubator-apisix/issues/1297#issuecomment-600966657
 
 
   mark first ,this is a issue in out production env, will offer more infomation later.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services