shreemaan-abhishek commented on issue #13333:
URL: https://github.com/apache/apisix/issues/13333#issuecomment-4437962090

   Hi @cclien0725, thanks for the detailed write-up your analysis is on point.
   
   Short answer: this is a real gap. APISIX currently has no built-in 
"gRPC-compliant rejection" path. `limit-conn` / `limit-req` / `limit-count` all 
reject the same way: `return conf.rejected_code [, { error_msg = ... }]` from 
the `access` phase, which `core.response.exit` (`apisix/core/response.lua`, 
`resp_exit`) translates into `ngx.status = code` + a JSON body + 
`ngx_exit(code)`. That path never inspects the request `Content-Type` or the 
upstream scheme, so a gRPC client downstream sees exactly the `transport: 
received the unexpected content-type` you described.
   
   Your low-priority `header_filter` + `body_filter` plugin that flips status 
to 200, sets `Content-Type: application/grpc`, empties the body and writes 
`grpc-status` / `grpc-message` trailers is the right mechanic today and is the 
recommended workaround. It matches the gRPC-over-HTTP/2 "Trailers-Only" 
response spec.
   
   If you or anyone else from the community is interested in driving this, 
please feel free to open a design issue or send a PR
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to