Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Launch subrequest before filter gets called

$
0
0
Dear Nginxers,

I previously wrote a post which got no response, after rereading it, it was in fact not clear at all... Mainly due to a misunderstanding on my side! This is the reason why i prefer starting a new thread to avoid confusions.

I came up with a solution where I have a filter which makes subrequests to various upstreams. It afterwards aggregates the responses along with the main request, manipulates the response and then calls the next filter with this. This is working nicely, all subrequests are sent in parrallel, so far so good...

However, this filter gets called only when we start receiving some data for the main request (which is also an upstream). This is not very efficient because if this upstream is slow, then the whole process is delayed!

In order to avoid this, how should i proceed ?
* Do i have to move my filter to a module hooked on CONTENT phase ? In that case, how to retrieve the subrequest responses, would it delay the filtering ?
* Trick the Content phase, so that filter is called immediately and the main request upstream is called by a subrequest ? (Yeah that's ugly !)

Thanks for your help,

kR

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>