My plugin needs to return a 401 HTTP response code at times.
So what I do today is using the channel and send a response:
So this is what makes the netty thread hang:
- Client sends a HTTP request with Connection:Keep-Alive
- I respond 401 (controller is closed, netty channel is not)
- Client continues in the same connection with a new request
- My plugin never get called again (because rest controller was closed, I guess)
See the snoop from Wireshark:
Digging on ES code, I noticed there's no keep alive check here when we close the controller,
But you do correctly check if the header is set when you go about sending the response at the channel level
Is this a bug on your side or should I send a 401 response differently from my plugin?