Local processing return values from fastcgi_pass

Maxim Dounin mdounin at mdounin.ru
Fri Aug 1 14:53:32 UTC 2014


On Fri, Aug 01, 2014 at 08:48:24AM -0400, itpp2012 wrote:

> For example I have one fastcgi_pass location block and I want to process the
> return values of a request to use in a second fastcgi_pass, is this possible
> ?
> location ... {
> ...
> fastcgi_pass server1;
> # server1 returns some values
> # process these values and call another fastcgi_pass server
> if (!$valuechecked) { return 404; }
> fastcgi_pass server2;
> }

If you are able to control the backend, this is something to be 
done with X-Accel-Redirect.  If you can't, and you have to inspect 
response body returned by server1, then the "out of the box" 
options is to use SSI include with "set" parameter, and do 
appropriate processing in SSI.  Or you may consider eval module by 
Valery Kholodkov, see here:


(not sure if it's still works though)

Maxim Dounin

More information about the nginx mailing list