Have a dozen of vhosts which sometime require IP filtering (maintenance ...) using 'geo'.
So
- 'geo' is in http context, and gives a variable a value depending on the IP filters => that declaration is in an include file "Geo"
- then have a 'error_page / location / rewrite / if / return' block => is in an include file "IP_filter"
To activate filtering, "include Geo;" is added in 'http', and "include IP_filter;" is injected in each 'server'
That's only 1 + N vhosts lines to add, but I was wondering if there is a more elegant way to inject the filtering into each 'server' (without modifying the files each time), like a "trick" in the 'http' block(?).
Of course I could include the same empty file "Injection" into each 'server', and only fill that file with a nested "include IP_filter" and reload the config, when necessary. But that doesn't seem very clean (to me at least).
Any suggestion is welcome.
Thank you.
So
- 'geo' is in http context, and gives a variable a value depending on the IP filters => that declaration is in an include file "Geo"
- then have a 'error_page / location / rewrite / if / return' block => is in an include file "IP_filter"
To activate filtering, "include Geo;" is added in 'http', and "include IP_filter;" is injected in each 'server'
That's only 1 + N vhosts lines to add, but I was wondering if there is a more elegant way to inject the filtering into each 'server' (without modifying the files each time), like a "trick" in the 'http' block(?).
Of course I could include the same empty file "Injection" into each 'server', and only fill that file with a nested "include IP_filter" and reload the config, when necessary. But that doesn't seem very clean (to me at least).
Any suggestion is welcome.
Thank you.