Relatively new to Apache modsec. Trying to do something simple and hitting a wall. I want to set an environment variable based on the User-Agent, and test it by setting a header. I have this:
SecRule HTTP_User_Agent "Gecko" "phase:2,nolog,setenv:MOZTEST=1,id:100000025"
Header always set MozTest "1" env=MOZTEST
Figured that in Firefox, the MozTest header should be set, but it's not. I also tried REQUEST_HEADERS:User-Agent in place of HTTP_User-Agent, but still no effect. Also tried increasing the phase to 5, even though it should have the user agent at phase 2. There is no error; the rule just doesn't seem to fire.
My guess is that the user-agent variable isn't set, but I don't know why. (Or even how to test that, as I've never had to do any custom logging.)