$upstream_http_* variables exist but do not seem to be readable

agentzh agentzh at gmail.com
Fri Feb 1 20:26:16 UTC 2013


Hello!

On Fri, Feb 1, 2013 at 6:48 AM, Maxim Dounin wrote:
>>               set_by_lua $use_token
>>               '
>>               if not ngx.var.sent_http_csrf  == "" then
>>                       return ngx.var.upstream_http_csrf
>>               end
>>               return "baz"
>>               '; # Always return 'baz'
>>                 add_header WIllThisWork $use_token; # Again, empty
>
> I'm not familiar with lua module, but likely the explanation is
> the same - set_by_lua is executed before a response is available.
>

Yes, set_by_lua runs at exactly the same phase of the standard
ngx_rewrite module's "set" directive. Actually set_by_lua is injected
into ngx_rewrite so that it can be mixed with other rewrite module
directives.

@shrikeh: you're recommended to read my Nginx tutorials to learn more
about the Nginx config directive running order:

    http://openresty.org/#eBooks

Best regards,
-agentzh



More information about the nginx mailing list