Multiple subrequests, each with a proxy_pass

scompt nginx-forum at
Wed Feb 2 14:40:54 MSK 2011

For a certain endpoint (/upload), I would like to sometimes (when
content-type matches) create a subrequest which calls an upstream with
proxy_pass to include content before the actual response, which is also
provided via proxy_pass. This isn't working right now and is only
returning the content of the subrequest's upstream. Is this even
possible? Here's the config that I'm using:

    location "/" {
        if ($content_type ~ "^multipart/form-data") {
            echo_subrequest $request_method /saver2;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://assets;

    location /saver2 {
        rewrite / /__testing__/saver break;
        proxy_pass http://filesaver;

Posted at Nginx Forum:,171508,171508#msg-171508

More information about the nginx mailing list