I work at a company where we use Nginx a lot and so far we are very
happy with it :). Now we want to add another feature to our website
and long story short we need to forward files that users send by POST
requests to backends. Now I know that there exists upload module for
Nginx, but it is a little bit not suitable for us because we would
like not to store request body on disk, but instead immediately
forward it to backend, even without storing the request body in
memory, i.e. initiate request to backend as soon as the request to
Nginx is started. Another gotcha is that the backend has to be chosen
in a way that might require sending one more request to determine the
In other words, this is what we would like to achieve:
1. User sends file to Nginx using POST.
2. Nginx sends request to an application server.
3. The application server returns address of one of backend servers
(something like X-Accel-Redirect, but for POST).
4. Nginx forwards user's request to the backend, but doesn't store
request body on disk or in memory.
There were some posts on the group regarding similar topics and it
looks like it can't be done in Nginx yet. So I will probably have to
write a module that combines functionality from upstream and upload
modules. Or maybe it can be done in some other way? I remember a
discussion about input filter chain a week or two ago. This may ease
the task, but the chain is not ready yet and I'm in a bit of hurry and
I guess I can't wait until it's ready.
What are your thoughts about this problem? Any comment or hint will be