Maxim Dounin
January 19, 2012 11:08AM
Hello!

On Thu, Jan 19, 2012 at 07:24:29AM -0500, bigplum wrote:

> Hi,
>
> Previously, I wrote a module to make a subrequest to backend. nginx.conf
> like that:
>
> location /file {
> nphase_uri /dummy;
> nphase_set_uri_var $np_uri http://backend;
> }
>
> location /dummy {
> proxy_pass $np_uri;
> }
>
> The module could send original URI "http://localhost/file/abcd.txt" to
> backend to process.
> And the module could get response from backend and decide to continue or
> refuse.
>
> But now This fix disabled sending original URI to backend.
>
> *) Bugfix: a "proxy_pass" directive without URI part might use
> original
> request after redirection with the "try_files" directive.
>
> If we need to send same request to backend, we must use named location.
> But it
> seems that named location is not support in subrequest. The named
> location only
> processed in try_files phase.
>
> Following configuration would not work, for the subrequest send a
> request "GET /dummy"
> rather than original URI.
>
> location /dummy {
> try_files /dummy @named;
> }
> location @named {
> proxy_pass $np_uri;
> }
>
> So how do I make it work?

You may explicitly specify URI you want to use in a request to
backend, i.e.

location /dummy {
proxy_pass $np_uri$request_uri;
}

Maxim Dounin

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

how to make a named location in subrequest

bigplum January 19, 2012 07:24AM

Re: how to make a named location in subrequest

Maxim Dounin January 19, 2012 11:08AM

Re: how to make a named location in subrequest

bigplum January 20, 2012 03:04AM

Re: how to make a named location in subrequest

bigplum January 20, 2012 03:23AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 314
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready