Asynchronous nginx response header/body filter

Asynchronous nginx response header/body filter

·

1 min read

As we all know, due to the design limit, nginx header/body filters are synchronous and you should not perform blocking operations such as blocking system calls, decrypting, decompressing, or forwarding responses to other servers for further processing.

In contrast, envoy supports asynchronous HTTP filters on the response path.

However, there are some use cases where the response headers and body from the upstream server must be processed asynchronously before being sent downstream, such as by requesting a Vault server to verify the digest of the body, or by scanning the content on a dedicated server for confidentiality reasons.

How to interpret the upstream response asynchronously? And what’s the performance?

Please visit my blog for more details:

http://luajit.io/posts/asynchronous-lua-filter-for-nginx-response/