Welcome! Log In Create A New Profile

Advanced

Re: add variable in module, change value in config

Maxim Dounin
October 26, 2011 12:20PM
Hello!

On Wed, Oct 26, 2011 at 11:36:00AM -0400, artemg wrote:

> I want to control behaviour of my module at runtime(body filtering
> phase), depending on different data (reg exp in headers, value of
> different variables...), so I decided to add variable in my module, and
> then set value in nginx config with "set" operation in rewrite module.
> I am adding variable via ngx_http_add_variable() in pre-config, set
> set_handler, and when I am doing "set $my_variable "0" " in nginx
> config, I get "duplicate variable my_variable" on nginx start up.
> What I am doing wrong?

Most likely you forgot to use NGX_HTTP_VAR_CHANGEABLE flag in
ngx_http_add_variable() call.

> May be I need to set variable by set, and In my
> module get index, and then get value of variable?

This may be a better approach. Or just accept a variable (or a complex
value) in your module configuration directive.

Maxim Dounin

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

add variable in module, change value in config

artemg October 26, 2011 11:36AM

Re: add variable in module, change value in config

Maxim Dounin October 26, 2011 12:20PM

Re: add variable in module, change value in config

artemg October 28, 2011 01:15AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready