nginx http-core enhancement: named location in subrequests + directive use_location
Maxim Dounin
mdounin at mdounin.ru
Thu Apr 30 13:55:41 UTC 2015
Hello!
On Wed, Apr 29, 2015 at 07:22:51PM +0200, Sergey Brester wrote:
[...]
> > And how it's expected to be processed in a named location if
> > r->uri is "@..."?
>
> Function "ngx_http_core_find_named_location" if location was found set
> "r->loc_conf = (*clcfp)->loc_conf" and returns NGX_OK.
The problem is that the r->uri will be illegal.
> > Note that named locations are ones where requests are handled
> > with their original URIs unmodified. This, in particular,
> > allows to use the original URI to select a file, or in a
> > request to the upstream server, etc. With what you are trying
> > to do it doesn't look different from a static location
>
> As I wrote it already (of course it is not a static location):
>
> Example, instead of :
>
> # auth_request /auth_loc/;
>
> You can use named location @auth_loc and write now:
>
> auth_request @auth_loc;
So what will happen if the location is:
location @auth_loc {
proxy_pass http://auth.backend;
}
Which URI will be used in a HTTP request to auth.backend? As far
as I see, with your code it will result in a
GET @auth_loc HTTP/1.0
request to the upstream server, and immediate 400 response is what
will happen.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list