Redirects do not work with x-aem-client-country header
Hi everyone,
I have a website in AEM Cloud, with custom CDN Imperva (that should be forwarding the header, since is exposing it also in the response section) and my goal is to redirect users based on their country, to the correct site.
Here is what I've done:
- Added "X-Aem-Client-Country" both in the clientheaders.any and the site.farm file. In the last one is in the /cache /headers section
- Added "Header set Vary "X-Aem-Client-Country" in the site.vhost file
- Added custom rewrites in the rewrite.rules file. Here is an example:
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{HTTP:X-Aem-Client-Country} ^US$ [NC]
RewriteRule ^.*$ /en-us [R=301,L] - As a "default" page I've left a "country choice" page that should hit when the country code is not among the ones specified in the rewrite.rules file
I've tried also with the name of the header in uppercase or lowercase but it changes nothing.
Maybe I'm forgetting something, but the situation right now is that the site is not redirecting to specific homepages when the "root" URL is opened (to be clear: only the site with the domain www.site.com should redirect to www.site.com/en-us if the user is from USA).
Someone has a suggestion about this matter?
Thank you!
