fastly/fastly-magento2

Geo IP only works with stores belong to websites which the request was made from.

kavingas opened this issue · 3 comments

Steps

  • Create 2 or more websites with store views
  • Configure Fastly GeoIP redirect to redirect requests to a different store that belongs to a website other than the request was made from
  • Access the store using an IP matching the GeoIP redirect rule

Actual Result
The request is not getting redirected

Expected Result
The request matching the GeoIP should get redirected to the desired store.

Extra details
The code under https://github.com/fastly/fastly-magento2/blob/master/Model/Config.php#L1155 checks whether the target store belongs to the same website that the request was made from.

This issue happens because GeoIP feature is relay on X-Magento-Vary or form_key cookies. See:
https://github.com/fastly/fastly-magento2/blob/master/etc/vcl_snippets/recv.vcl#L112-L114
Both cookies are intended to be used by internal Magento features only and are set or not based on those features' needs. Fastly GeoIP or any other 3rd party libraries shouldn't rely on any Magento cookie, including mentioned X-Magento-Vary cookie.

We'll look into it. It may take a bit as there is quite a bit of risk involved.

Released in 1.2.188