# Multiple subrequests, each with a proxy\_pass

**URL:** <https://www.ruby-forum.com/t/multiple-subrequests-each-with-a-proxy-pass/202609>\
**Category:** NGINX\
**Created:** [February 2, 2011, 12:42pm UTC](https://www.ruby-forum.com/t/multiple-subrequests-each-with-a-proxy-pass/202609 "2011-02-02T12:42:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 2, 2011, 12:42pm UTC](https://www.ruby-forum.com/t/multiple-subrequests-each-with-a-proxy-pass/202609/1 "2011-02-02T12:42:23Z")

</div>

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:

```
[code]
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 {
    internal;
    rewrite / / __testing__ /saver break;
    proxy_pass http://filesaver;
}

```

[/code]

Posted at Nginx Forum:

> **[Multiple subrequests, each with a proxy\_pass](https://forum.nginx.org/read.php?2,171508,171508#msg-171508)**
>
> 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...
