I'm researching possible approaches to development of asynchronous GridFS
module for Nginx (because the existing one blocks the main Nginx thread).
I've read the source codes of most modules from
https://www.nginx.com/resources/wiki/modules/ and found that all of
asynchronous modules (e.g. Postgres or Mongo) implement the database
protocol by itself working with upstream. Is it the only way? I would like
to use mongo-c-driver (https://github.com/mongodb/mongo-c-driver) but I
need an example how to embed it into Nginx event loop to make non-blocking
Could you suggest any module that uses the same approach or some manual
I have a module (naxsi) that reads the body during the REWRITE phase, in
the exact same way that ngx_form_input does :
When used with auth_request (or maybe other modules, but that's the
first time I encounter this issue within a few years of usage), there is
no request made to the upstream if the request is made using POST/PUT
and the body is bigger than client_body_buffer_size.
For the simplicity of the example, we'll assume I'm talking about
ngx_form_input (behaviour is the same, except code is way shorter).
The user reporting me the bug opened a ticket :
https://trac.nginx.org/nginx/ticket/801. It is possible to replace naxsi
with ngx_for_input and obtain the same results.
From Maxim's reply, it seems I failed to properly restore request
handlers after reading body.
What would be (if there is any) the proper way to read body within
REWRITE phase ? Is there any example/existing module that does such so I
can understand what am I doing wrong ? (In the past, I always thought
ngx_form_input was the reference one).
PS: You can find a bit more details here :
https://github.com/nbs-system/naxsi/issues/226 (including sample config
& commands to reproduce bug)
In our case, we needed to set proxy_http_version to 1.0 or 1.1 according to
client, because the clients for http 1.0 could not proceed chunked encoding
gzip through keep-alive connections correctly, but 'proxy_http_version'
Finally we had this patch, and a simple test case for it, and I checked it
Wish it helps.