I need to vary my responses on the value of `Cf-Ipcountry`.
Every request to the site will be coming through cloudflare and i need to vary the pages on this request headers value.
So far ive tried:
RewriteCond %{HTTP:HTTP_CF_IPCOUNTRY} (.+)
RewriteRule .* - [E=Cache-Control:vary=%1]
And
SetEnvIf Cookie "cfCountry=(.*)" HAVE_country=1
RequestHeader set Cookie "cfCountry=%{http:Cf-Ipcountry}e; path=/;" env=!HAVE_country
Header set Set-Cookie "cfCountry=%{http:Cf-Ipcountry}e; path=/;" env=!HAVE_country
RewriteRule .* - [E=Cache-Vary:cfCountry]
And a variation of the above:
RewriteCond %{REQ:CF_IPCOUNTRY} (.*)
RewriteRule ^/ - [env=CF_COUNTRY:%1]
RequestHeader set Cookie "cfCountry=%{CF_COUNTRY}e; path=/;"
Header set Set-Cookie "cfCountry=%{CF_COUNTRY}e; path=/;"
RewriteRule .* - [E=Cache-Vary:cfCountry]
None of which seem to work?
Im sure someone must of had this need before but im not a .htaccess or litespeed genius so my knowledge trying to describe the problem is a little limiting.
In short i need to take the value cloudflare gives me in the header "Cf-Ipcountry" and either set a cookie i can vary on, or use it as the vary value. I need to do this at the .htaccess level as higher up isnt an option and in the app its too late.
Every request to the site will be coming through cloudflare and i need to vary the pages on this request headers value.
So far ive tried:
RewriteCond %{HTTP:HTTP_CF_IPCOUNTRY} (.+)
RewriteRule .* - [E=Cache-Control:vary=%1]
And
SetEnvIf Cookie "cfCountry=(.*)" HAVE_country=1
RequestHeader set Cookie "cfCountry=%{http:Cf-Ipcountry}e; path=/;" env=!HAVE_country
Header set Set-Cookie "cfCountry=%{http:Cf-Ipcountry}e; path=/;" env=!HAVE_country
RewriteRule .* - [E=Cache-Vary:cfCountry]
And a variation of the above:
RewriteCond %{REQ:CF_IPCOUNTRY} (.*)
RewriteRule ^/ - [env=CF_COUNTRY:%1]
RequestHeader set Cookie "cfCountry=%{CF_COUNTRY}e; path=/;"
Header set Set-Cookie "cfCountry=%{CF_COUNTRY}e; path=/;"
RewriteRule .* - [E=Cache-Vary:cfCountry]
None of which seem to work?
Im sure someone must of had this need before but im not a .htaccess or litespeed genius so my knowledge trying to describe the problem is a little limiting.
In short i need to take the value cloudflare gives me in the header "Cf-Ipcountry" and either set a cookie i can vary on, or use it as the vary value. I need to do this at the .htaccess level as higher up isnt an option and in the app its too late.