Any way for a module to set directives when it's loaded?

Maxim Dounin mdounin at mdounin.ru
Tue Jun 16 12:58:29 UTC 2020


Hello!

On Mon, Jun 15, 2020 at 10:52:20AM -0700, Ryan Burn wrote:

> Suppose I'm writing an nginx module foo. Is there any way to have foo
> set default directives when it gets loaded?
> 
> For example, if I wanted foo to add headers to every request could I have
> 
> load_module modules/ngx_http_foo_module.so;
> 
> implicitly add
> 
> proxy_set_header foo-header bar-value;
> ...
> 
> to the http context?

No, this is not something possible.  Consider instructing your 
module users to add relevant proxy_set_header directives to the 
configuration instead.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list