Geo IP Redirect Module Compatibility with Varnish

Is the Geo IP Redirect module compatible with Varnish?

Starting from version 1.7.0, the Geo IP Redirect extension does work with Varnish cache, but requires a few changes in the web server configuration for that. Please contact your hosting provider on this matter or follow the steps below.

Step 1. Open the Varnish configuration fileUsually, it is placed here:

/usr/varnish/default.vcl

Step 2. Kindly insert the code below into default.vcl in the vcl_recv section before the last line after all existing instructions:

if (req.http.Cookie !~ "geoip_redirect_for_varnish" 
&& req.url !~ "^/(pub/)?(media|static)/.*"
&& req.url !~ "/graphql"
&& !req.http.x-long-cache
&& req.http.X-Requested-With != "XMLHttpRequest"
) {
return (pass);
}

Step 3. Once done, kindly restart Varnish.

Kindly note that our extension doesn't influence the performance of Varnish itself. The server configuration above ensures receiving the correct IP address of the customer and thus, redirecting them to the correct store (according to the extension settings). 

      • Related Articles

      • Why Geo IP Redirect module does not work when using Amasty Service?

        In order for the module to redirect customers correctly, the IP database should be first imported in Stores → Configuration → Amasty Extensions → Geo IP Data. In case Amasty Service is used for IP Database Update Settings in Stores → Configuration → ...
      • How does the Geo IP Redirect module work with Cloudflare?

        There is a known issue with using the Geo IP Redirect module with Cloudflare. It occurs due to the actual IP address of a customer being replaced by the proxy IP. To introduce compatibility between Cloudflare and the Geo IP Redirect module, follow ...
      • What is the difference between Geo IP Redirect and Store Switcher?

        Geo IP Redirect and Store Switcher are the two names of the same Amasty extension, they deliver identical functionality. Several product pages have been created to reveal the functionality of the module from different angles.
      • How to remove GET parameters from Redirect URLs?

        Since v.1.6.0 of the module, we have added the ability to exclude GET parameters from Redirect URLs. Please note that the Exclude GET Parameters from Redirect URL feature is available only as a part of an active product or support subscription. You ...
      • Will the module work on Magento Cloud with Fastly?

        Starting from version 1.7.0, the Geo IP Redirect extension works with Fastly cache, but requires a few changes in the configuration for that. Please, navigate to Advanced > System > Full Page Cache > Custom vcl snippet and setup the following ...