Welcome! Log In Create A New Profile

Advanced

Re: Upstream with multiple request reply

Maxim Dounin
January 16, 2012 05:18PM
Hello!

On Mon, Jan 16, 2012 at 10:45:58PM +0100, Bertrand Paquet wrote:

> Hi,
>
> Arg, it's not a good news :)
>
> Do you think I can do ngx_http_subrequest to do some additional request to
> back end ?
> How to say to nginx to wait for subrequest before calling create_request ?

If you are ok with *independent* requests to backend (that is, you
just need to requests two happen, but don't need to implement some
complex protocol), than using subrequests is right way to go.

See e.g. addition filter module sources for simple subrequest
usage example, or ssi module sources for more complex one.

Maxim Dounin

>
> Regards,
>
> Bertrand
>
>
> On Mon, Jan 16, 2012 at 22:20, Maxim Dounin <mdounin@mdounin.ru> wrote:
>
> > Hello!
> >
> > On Mon, Jan 16, 2012 at 09:40:26PM +0100, Bertrand Paquet wrote:
> >
> > > Hi all,
> > >
> > > I'm trying to write an upstream which have to do multiple request / reply
> > > with backend, for one frontend request.
> > >
> > > Currently,
> > > - I'm writing first request to backend in create_request handler, write
> > > data into r->upstream->request_bufs, and returning NGX_OK
> > > - Nginx call me on process_header. I can read data from
> > > r->upstream->buffer. I can loop on process_header if I return NGX_AGAIN.
> > > But I'm not able to send more data to backend. I try to add buffer in
> > > r->upstream->request_bufs, in r->upstream->request_bufs->next, nothing
> > work.
> > >
> > > Anybody know how to send data to backend in the process_header callback ?
> >
> > The upstream module is designed to handle "single request - single
> > response" model, it's not capable of sending multiple requests to
> > backend.
> >
> > Maxim Dounin
> >
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >

> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Upstream with multiple request reply

bpaquet January 16, 2012 03:42PM

Re: Upstream with multiple request reply

Maxim Dounin January 16, 2012 04:22PM

Re: Upstream with multiple request reply

bpaquet January 16, 2012 04:48PM

Re: Upstream with multiple request reply

Maxim Dounin January 16, 2012 05:18PM

Re: Upstream with multiple request reply

bigplum January 16, 2012 10:14PM

Re: Upstream with multiple request reply

bpaquet January 17, 2012 05:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 110
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready