i am trying to set the cookies value to a environment variable. Which is a country code. Part of the configuration as below.
MaxMindDBEnable On
MaxMindDBFile COUNTRY_DB /etc/apache2/GeoLite2-Country.mmdb
MaxMindDBEnv MM_COUNTRY_CODE COUNTRY_DB/country/iso_code
Want to set the cookie name "CC" value to "MM_COUNTRY_CODE" from above. i have tried the below but getting a NULL.
SetEnvIf Cookie "cccookie=([^;]+)" MM_COUNTRY_CODE=$1
Header set Set-Cookie "CC=%{CCCOOKIE}e;path=/;Expires=MI3600" env=MM_COUNTRY_CODE
any suggestions ?
You can replace below lines
SetEnvIf Cookie "cccookie=([^;]+)" MM_COUNTRY_CODE=$1
Header set Set-Cookie "CC=%{CCCOOKIE}e;path=/;Expires=MI3600" env=MM_COUNTRY_CODE
with this below line
Header add set Set-Cookie "CC=%{MM_COUNTRY_CODE}e"
'%{MM_COUNTRY_CODE}e' The contents of the environment variable MM_COUNTRY_CODE.notice the 'e'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With