Restore visitors original IP from CloudFlare in Magento 2

On by

less than 1 minute read

You can restore original customer or visitor IP address in Magento 2 without need for official CloudFlare extension.

<type name="Magento\Framework\HTTP\PhpEnvironment\RemoteAddress">
    <arguments>
        <argument name="alternativeHeaders" xsi:type="array">
            <item name="http_cf_connecting_ip" xsi:type="string">HTTP_CF_CONNECTING_IP</item>
        </argument>
    </arguments>
</type>