Multiple subrequests, each with a proxy_pass

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs