Closed weestack closed 1 year ago
Hello @weestack ,
ModSecurity v3 supports setenv, but you will likely encounter limitations related to nginx itself. nginx doesn't support use of environment variables out-of-the-box the same way that Apache does.
I have, however, seen some users refer to some tools, such as envsubst, that do enable some such use.
The variety of contexts or use cases where such tools might meet your needs may vary.
Hi @weestack Did you find any solution for nginx?
@martinhsv Is it possible to set some variable to header? Because Nginx can access to header like http_x_modsec_rule_id.
Hi @fatihusta,
Is it possible to set some variable to header?
Yes, it is, but after a quick check I can say Nginx is not able to create header from environment variable - see previous comment.
Because Nginx can access to header like http_x_modsec_rule_id.
Yes, but the connector does not handle the previously set environment variables. (Consider which environments need to handle?)
I see the legitimacy of the your request, but at the moment it is not a priority, sorry.
If you have any solutions, please send it as pull request.
Hi @airween Thank you for your answer.
Hello there,
In apache its possible to use environment variables defined in modsecurity for the apaches access logging, I have been trying to use the same for nginx, but so far have not been able to, is this something thats only implemented for apache?
Modescurity.con:
nginx.conf
Where in Apache you would be able to use the env vars like this: