Passing cookie values to other modules

  • DFresh4130

    I'm trying to use setenvifplus in conjunction with mod_substitute and mod_filter. I have the below line in my configuration, but I don't believe it's working as I tried just adding the environment variable to my LogFormat line and the cookie data doesn't show in my access logs. Just getting the "-" value for that variable in my logs. Any suggestions as to how I can capture specific cookie data and set it as an environment variable for other modules to use?

    SetEnvIfPlus %{HTTP_COOKIE} DISPLAY_TYPE=customer env-variable=CUSTOMER
    LogFormat "%{CLIENTIP}e %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{CUSTOMER}e" combined
  • I think

    SetEnvIfPlus Cookie DISPLAY_TYPE=(customer) CUSTOMER=$1

    is more of what you want.

    Please note, that mod_setenvifplus is not yet able to add filters (this needs a code change first).

  • mod_setenvifplus version 0.25 has now a new directive called "AddOutputFilterPlus". Example:

       SetEnvIfPlus Cookie DISPLAY_TYPE= REPLACE
       AddOutputFilterPlus SUBSTITUTE REPLACE
       Substitute s/foo/bar/ni