Skip to content

Instantly share code, notes, and snippets.

@erikhansen
Last active June 29, 2026 19:27
Show Gist options
  • Select an option

  • Save erikhansen/2e35fc65c72259aad2b15249cf079fc9 to your computer and use it in GitHub Desktop.

Select an option

Save erikhansen/2e35fc65c72259aad2b15249cf079fc9 to your computer and use it in GitHub Desktop.
Adobe Commerce Cloud w/ Cloudfare VCL configuration

Overview

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:

  1. Login to the Magento admin and go to STORES > Configuration > ADVANCED > System and expand the Full Page Cache > Fastly Configuration > Custom VCL Snippets section.
  2. Click the "Create" button and add this information:
    1. Name: forward_client_ip (or whatever you want to call it)
    2. Type: recv
    3. Priority: 100
    4. VCL:
if (req.http.CF-Connecting-IP) {
  set req.http.Fastly-Client-IP = req.http.CF-Connecting-IP;
}
  1. Click the "Upload VCL to Fastly" button

Testing

  1. Before making the change, load url like https://example.com/customer/account/login/?testing=123 in your browser
  2. In New Relic, go to Logs and filter by `filePath:"/var/log/platform/*/access.log" message:"testing=123"
  3. You'll see the IP listed is not your IP
  4. Make the change above
  5. The IP listed should now be your IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment