We (Kraken Commerce) recommend using Cloudflare in front of Adobe Commerce Cloud environments, as Cloudflare provides excellent bot-fighting and performance tools. However a small change is needed in the Magento VCL to pass the user's IP from Cloudflare>Fastly/Varnish>Nginx so that user's IPs are stored in the access logs correct.
Steps:
- Login to the Magento admin and go to
STORES > Configuration > ADVANCED > Systemand expand theFull Page Cache > Fastly Configuration > Custom VCL Snippetssection. - Click the "Create" button and add this information:
- Name: forward_client_ip (or whatever you want to call it)
- Type: recv
- Priority: 100
- VCL:
if (req.http.CF-Connecting-IP) {
set req.http.Fastly-Client-IP = req.http.CF-Connecting-IP;
}
- Click the "Upload VCL to Fastly" button
- Before making the change, load url like
https://example.com/customer/account/login/?testing=123in your browser - In New Relic, go to
Logsand filter by `filePath:"/var/log/platform/*/access.log" message:"testing=123" - You'll see the IP listed is not your IP
- Make the change above
- The IP listed should now be your IP