All Collections
Compatibilities
Cloudflare
Configuring Geolocation on Cloudflare + WooCommerce + NitroPack
Configuring Geolocation on Cloudflare + WooCommerce + NitroPack
Updated over a week ago

In case you have a plugin which relies on WooCommerce Geolocation, and if at the same time you're running CloudFlare, this may cause issues with NitroPack's optimizations.

You can identify if such an issue exists in case everything below is true:

  • You are using a plugin which relies on WooCommerce Geolocation (for example, WooCommerce Multi Currency Premium);

  • Cloudflare is active;

  • Most NitroPack optimizations are with the status "Skipped" because of a redirect.

To solve this, go to the CloudFlare Dashboard, find Networking, and disable CloudFlare Geolocation. Geolocation will still work, as WooCommerce will provide it. Read on to see why Cloudflare Geolocation must be disabled in this scenario.

The root cause

The Cloudflare service provides a header in all requests coming to your site: CF-IPCOUNTRY. This header is used by WooCommerce Geolocation to identify the source country of the visitor.

The NitroPack optimization service tries to simulate the user country by providing the header X-FORWARDED-FOR, containing the original user IP address. However, your site redirects the NitroPack service to the incorrect country based on CF-IPCOUNTRY, not on X-FORWARDED-FOR.

For NitroPack to work, your site WooCommerce Geolocation must not see CF-IPCOUNTRY. CF-IPCOUNTRY is removed by disabling the Cloudflare Geolocation.

Did this answer your question?