Skip to content

help request: grpc request proxy http code must be 599 when request not success #7298

@caozhi6655

Description

@caozhi6655

Description

I use apisix for grpc proxy。I use a custom lua plugin to process the request,when some request param not right,i return code like:

core.response.add_header("Content-Type", "application/grpc")
                    
core.response.add_header("grpc-status", "16")
                    
core.response.add_header("grpc-message", "UNAUTHENTICATED")
                    
return 200

and I use a grpc tool "bloom-rpc" to debug the request,then the "bloom-rpc" return like

"error": "2 UNKNOWN: No status received"

and I tried golang client to debug,it returns err server closed the stream without sending trailers

I don't know why,and i debuged a whole day。。。

and when i set the status code 200 -> 599,it worked。。
so i what know why?

and another question,it works well in kong the code like that

return kong.response.exit(200, nil, {
    ["Content-Type"] = "application/grpc",
    ["grpc-status"] = 16,
    ["grpc-message"] = "UNAUTHENTICATED"
})

Hope the answer! Thanks very well!

Environment

  • APISIX version (run apisix version):2.13
  • Operating system (run uname -a):centos os 7.9
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions