Welcome! Log In Create A New Profile

Advanced

Re: auth_request_set into variable and lua

Maxim Dounin
December 05, 2012 06:22AM
Hello!

On Tue, Dec 04, 2012 at 06:19:02PM -0800, agentzh wrote:

> Hello!
>
> On Tue, Dec 4, 2012 at 2:18 PM, djczaski wrote:
> > Trying to get a header from an auth_request into a variable and use it from
> > Lua with no luck. This was the simple example I tried.
> >
>
> You're making several mistakes. See the discussion below:
>
> > location = /auth {
> > add_header X-Boo "Hello World";
>
> Mistake #1: The add_header directive from the standard ngx_headers
> module has no effect on subrequests while your location /auth here is
> accessed by a subrequest issued via the auth_request directive.
>
> > return 204;
> > }
> >
> > location /test {
> > auth_request /auth;
> > auth_request_set $test $upstream_http_x_boo;
>
> Mistake #2: The $upstream_http_XXX variables are only meaningful when
> the *current* location is configured by one of those Nginx upstream
> modules like ngx_proxy, ngx_fastcgi, ngx_uwsgi, and etc. Here your
> current location, location /test, is not configured by any Nginx
> upstream modules (neither ngx_auth_request nor ngx_lua are upstream
> modules).
>
> Mistake #3: The $upstream_http_XXX variables are only in effect for
> the current request. It won't inherit values from any other requests
> including subrequests.

The #2 and #3 are the reasons why the auth_request_set directive
exists: it allows to store variables specific to auth subrequest,
like $upstream_http_*, in variables of main request.

So the only valid problem in config is #1.

[...]

--
Maxim Dounin
http://nginx.com/support.html

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

auth_request_set into variable and lua

djczaski December 04, 2012 05:18PM

Re: auth_request_set into variable and lua

agentzh December 04, 2012 09:20PM

Re: auth_request_set into variable and lua

djczaski December 04, 2012 10:38PM

Re: auth_request_set into variable and lua

agentzh December 05, 2012 10:04PM

Re: auth_request_set into variable and lua

djczaski December 05, 2012 10:36PM

Re: auth_request_set into variable and lua

agentzh December 05, 2012 11:02PM

Re: auth_request_set into variable and lua

Maxim Dounin December 05, 2012 06:22AM

Re: auth_request_set into variable and lua

djczaski December 05, 2012 09:27AM

Re: auth_request_set into variable and lua

djczaski December 05, 2012 09:27AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 83
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