How to Install Bubblegum: Web Manager Guide (Cloudflare Edition)
If you have any questions throughout this set up process, feel free to book a meeting here, message us in slack (or join our slack), or email us at [email protected].
Introduction
Modern AI tools like ChatGPT, Perplexity, and Claude are becoming key discovery engines — crawling, interpreting, and recommending brand content. To ensure these tools interpret your site accurately, Bubblegum offers a lightweight middleware solution built on Cloudflare.
This comprehensive guide covers the complete setup and deployment process for Bubblgum Middleware. This solution leverages Cloudflare's edge computing capabilities to seamlessly direct AI agent traffic to structured, machine-readable content while maintaining normal user experiences.
What is Middleware?
AI agents are now an important segment of web traffic, discovering, indexing, and interacting with your digital content. This middleware acts as an intelligent router – seamlessly directing recognized AI bot traffic to AI-optimized, relevant pages while serving regular visitors as normal.
For e-commerce brands, this middleware integrates with Shopify's Cloudflare O2O (Online-to-Offline) capability, enabling advanced traffic management and optimization.
How It Works
Interception
The Cloudflare Worker sits between your domain and all incoming traffic
Bot Detection
Each request's user-agent (and optionally headers) are checked against a curated list of bot patterns, including major LLMs, scrapers, and headless browsers
Dynamic Routing
AI bot requests: Redirected to an AI-ready version of the content (e.g.,
/aboutbecomes/about.md)Non-bot traffic: Served as usual with no disruption or latency
Custom Patterns
Easily extend detection rules for emerging bots or proprietary assistants
Technical Stack
Deployed as a Cloudflare Worker (via Wrangler CLI)
Handles GET, POST, and all HTTP verbs
Setup Instructions
Please note that if you do not yet use Cloudflare, you'll need to set up an account to set up Bubblegum middleware.
Phase 1: Initial Cloudflare Account Setup
If you already use Cloudflare to manage your domain, you can SKIP to Phase 2
Before beginning the setup process, ensure you have:
Step 1: Setup Cloudflare Account
Cloudflare provides the foundation for Bubblegum's middleware deployment. The account setup process involves domain registration, plan selection, and initial configuration.
Start by creating an account if you don’t have one - or log into existing account if you already manage your domain in Cloudflare.
Step 2: Add Domain to Cloudflare
Once logged in you can click on the Add button in the top right → Connect a domain

This process will scan your existing DNS records and prepare them for migration to Cloudflare's infrastructure.
Enter domain in the first text input box
Keep the default selected option: Quick Scan for DNS records
Select “Do not block (off)” AI training bots
Click on continue

Step 3: Select Workers Paid Plan
While the free plan can technically support smaller sites, it’s very likely the limits would be exceeded quickly. If that happens, the middleware would just show the human version of the page to AI visitors by default - which we don’t want to happen.

Step 4: Domain Activation Process
After plan selection, you'll need to activate your domain by updating nameservers. This is a critical step that transfers DNS management to Cloudflare.
Important: Before moving to domain activation, confirm all DNS records and ensure you do not enable proxying (the orange cloud) for any records that need to be verified by third-party providers. (For example: CNAME records required by Attentive, Klaviyo, SendGrid, and similar ESP providers).
These records must remain “DNS only” (grey cloud) until their verification process completes. Proxying these records during verification may result in blocked validation.
Why: Cloudflare’s proxy can obscure DNS records, preventing third-party platforms from properly verifying domain ownership or email sending. Making this check before activating the domain will avoid delays and ensure all necessary integrations are successful.

Step 5: Nameserver Configuration
Update nameservers at your domain registrar to point to Cloudflare's nameservers.
This step is crucial for middleware functionality. You'll need to:
Follow on-screen instructions for your specific domain provider
Use provider-specific guides: Consult the official nameserver update documentation for detailed instructions
Verify propagation using DNS checking tools
Important: DNS propagation can take up to 24-48 hours. The middleware cannot function until nameservers are fully propagated.
Your DNS settings will be managed through Cloudflare going forward rather than your original domain provider so please save your Cloudflare login information (easiest to login with your email provider like Gmail).
Other software platforms often ask you to edit DNS records, so you'll need access to do so in the future.
Your domain annual auto-renewal will still be managed in your original provider.
Step 6: Verification and Confirmation
Once nameserver changes are made:
Click "Continue" in the Cloudflare dashboard
Use the "Check nameservers" function
Wait for confirmation that changes have propagated
Verify that your domain is "Active" in Cloudflare
If you have any questions throughout this set up process, feel free to book a meeting here, message us in slack (or join our slack), or email us at [email protected].
Phase 2: API Token Creation and Configuration
Understanding API Tokens vs API Keys
Cloudflare API tokens provide more granular security than legacy API keys. Tokens can be scoped to specific resources and operations, following the principle of least privilege.
Step 1: Access API Token Management
Navigate to Account API Tokens in your Cloudflare dashboard.
Step 2: Token Template Selection
For middleware deployment, use the "Edit Cloudflare Workers" template, which provides the necessary permissions:
No changes are needed to the permissions of this template.

Step 3: Zone Specification
Configure the token to be scoped to your specific domain zone. This enhances security by limiting the token's scope to only the necessary resources.
Zone Configuration:
• Include: Specific zone (your domain)
• Resource scope: Limited to target domain only
• IP address filtering: Optional but recommended for enhanced security

Once done, click on continue and then send the token to [email protected] or in our shared slack channel.
Step 4: Account ID Retrieval
The Account ID is required for Worker deployment. You can find it in your Cloudflare dashboard URL:
<https://dash.cloudflare.com/{ACCOUNT_ID}/home/domains>Send the Account ID to [email protected] or in our shared slack channel.
Step 5: Add Bubblegum to Cloudflare Account
Log in to the Cloudflare dashboard.
Select your account.
Go to Manage Account → Members.
Click Invite.
Enter [email protected]
Select access scope (recommended: choose the specific domain/zone if possible).
Assign the Super Administrator role, which allows:
Deploying/managing Workers
Editing routing rules, middleware, and settings
Managing DNS records
Continue to summary and complete the invite.
If you want to give Bubblegum a more limited role, you must allow at least the following
Required permissions:
Zone: Settings: Edit
Zone: Read
DNS: Edit
Account: Cloudflare Workers: Edit
Phase 3: DNS Configuration for Middleware
Understanding DNS Routing for Middleware
Proper DNS configuration is essential for middleware functionality. The middleware intercepts traffic at the edge before it reaches your origin server.
DNS Record Configuration
Set up CNAME records in Cloudflare DNS management:
For E-commerce/Shopify Integration:
• Root/apex domain: example.com → shops.myshopify.com (Proxied: ON)
• WWW subdomain: www.example.com → shops.myshopify.com (Proxied: ON)
Important Notes:
• Proxy Status: Must be set to "Proxied" (orange cloud) for middleware to function
• Existing Records: You do not need to remove existing Shopify-created DNS records
• Precedence: Cloudflare's proxy will handle routing appropriately
Verification Steps
DNS Propagation Check: Use tools like
digor online DNS checkersProxy Status Verification: Ensure orange cloud icon is active
SSL Certificate: Verify SSL/TLS is properly configured
Origin Connectivity: Test that your origin server is reachable
Frequently Asked Questions:
Last updated
Was this helpful?





