• Product Introduction
  • Quick Start
    • Importing a Git Repository
    • Starting From a Template
    • Direct Upload
    • Start with AI
  • Framework Guide
    • Frontends
      • Vite
      • React
      • Vue
      • Other Frameworks
    • Backends
    • Full-stack
      • Next.js
      • Nuxt
      • Astro
      • React Router
      • SvelteKit
      • TanStack Start
      • Vike
    • Custom 404 Page
  • Project Guide
    • Project Management
    • edgeone.json
    • Configuring Cache
    • Error Codes
  • Build Guide
  • Deployment Guide
    • Overview
    • Create Deploys
    • Manage Deploys
    • Deploy Button
    • Using Github Actions
    • Using Gitlab CI/CD
    • Using CNB Plugin
    • Using IDE PlugIn
    • Using CodeBuddy IDE
  • Domain Management
    • Overview
    • Custom Domain
    • HTTPS Configuration
      • Overview
      • Apply for Free Certificate
      • Using Managed SSL Certificate
    • Configure DNS CNAME Record
  • Observability
    • Overview
    • Metric Analysis
    • Log Analysis
  • Pages Functions
    • Overview
    • Edge Functions
    • Cloud Functions
      • Overview
      • Node Functions
  • Middleware
  • KV Storage
  • Edge AI
  • API Token
  • EdgeOne CLI
  • Pages MCP
  • Message Notification
  • Integration Guide
    • AI
      • Dialogue Large Models Integration
      • Large Models for Images Integration
    • Database
      • Supabase Integration
      • Pages KV Integration
    • Ecommerce
      • Shopify Integration
      • WooCommerce Integration
    • Payment
      • Stripe Integration
      • Integrating Paddle
    • CMS
      • WordPress Integration
      • Contentful Integration
      • Sanity Integration
      • Payload Integration
    • Authentication
      • Supabase Integration
      • Clerk Integration
  • Best Practices
    • Using General Large Model to Quickly Build AI Application
    • Use the DeepSeek model to quickly build a conversational AI site
    • Building an Ecommerce Platform with Shopify
    • Building a SaaS Site Using Supabase and Stripe
    • Building a Company Brand Site Quickly
    • How to Quickly Build a Blog Site
  • Migration Guides
    • Migrating from Vercel to EdgeOne Pages
    • Migrating from Cloudflare Pages to EdgeOne Pages
    • Migrating from Netlify to EdgeOne Pages
  • Troubleshooting
  • FAQs
  • Contact Us
  • Release Notes

Migrating from Cloudflare Pages to EdgeOne Pages

This guide will help you smoothly migrate your Cloudflare Pages project to EdgeOne Pages.


Preparations: Search Build Command and Build Output

Start by finding the build command and build output of your Cloudflare Pages project.
1. Log in to the dashboard and find the project to migrate.
2. Enter the project's "Settings" tab and view the "Build Configuration" module.
3. Record the values of the "Build command" and "Build output" fields.






Example:
npm run build
Build output: build

This information will be used in project configuration.


2.Configuration Migration: Handle Redirects and Headers

Cloudflare Pages uses _redirects and _headers files to configure redirect rules and custom headers. These configurations require migration to the edgeone.json file in EdgeOne Pages.

Comparison example of both

Cloudflare Pages _redirects file:
/old-path /new-path 301
/api/* /api/proxy 200
Cloudflare Pages _headers file:
/*
X-Frame-Options: DENY
X-Content-Type-Options: nosniff

/assets/*
Cache-Control: public, max-age=31536000

In EdgeOne Pages, we need to create an edgeone.json file to include these configurations:
{
"redirects": [
{
"source": "/old-path",
"destination": "/new-path",
"statusCode": 301
}
],
"rewrites": [
{
"source": "/api/*",
"destination": "/api/proxy"
}
],
"headers": [
{
"source": "/*",
"headers": [
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
}
]
},
{
"source": "/assets/*",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000"
}
]
}
]
}
During the migration process, the mapping between Cloudflare Pages configuration files and EdgeOne Pages is as follows:
_headers file corresponds to headers configuration.
_redirects file in the file corresponds to redirects configuration.
Proxy rewrite rules (such as /api/*) correspond to rewrites configuration.

For detailed configuration options, see edgeone.json document.


3.Function Migration: From Cloudflare Pages to EdgeOne Pages

The two platforms are relatively consistent in syntax and usage.

Here is a simple example:
// Cloudflare Pages Functions
export function onRequest(context) {
return new Response("Hello, Cloudflare Pages!");
}

// EdgeOne Pages Functions
export function onRequest(context) {
return new Response("Hello, EdgeOne Pages!");
}

main similarities
Both platforms use the onRequest function to handle all HTTP methods.
Functions on both platforms receive a context object containing request information and environment variables.
Same response method, both use Response object.
Routing rules are basically the same, supporting file system-based routing and dynamic routing.
Note:
Note: Pages and Functions support Node Functions and Edge Functions, with some differences in features such as the context object. You can select based on your requirements.

Migration suggestions: No need to change code writing and calling.

Note: If you need to migrate from Cloudflare Workers to Cloudflare Pages Functions, refer to the documentation. After successful migration, you can try the above migration steps. If you still have questions, contact us through the community for problem-solving.

For detailed function usage, see Pages Functions documentation.


4.Project Deployment: Create a New Project on EdgeOne Pages

After preparation work is completed, create and deploy the project on Pages.
1. Log in to the Tencent Cloud console and enter Pages service.
2. Click "Create project" and select your GitHub repository.
3. In the project settings, fill in the build command and build output recorded earlier.
4. Click the "Start deployment" button, and Pages will auto-build and deploy your project.


5.Domain Configuration: Adding a Custom Domain

migration steps
1. Add your custom domain in project settings and get the CNAME record value.
2. Log in to your DNS provider console (if your domain is managed by Cloudflare, sign in to the Cloudflare console).
3. Find the CNAME record previously set for Cloudflare Pages.
4. Update the CNAME record to point it to the new value provided by EdgeOne Pages.
5. If you set up other DNS records (such as A or AAAA records) for Cloudflare Pages earlier, delete these records.
6. Wait for the DNS update to take effect (may take a few minutes to a few hours).

Note: If your domain was previously managed by Cloudflare, you can choose to continue using Cloudflare's DNS service, just update the corresponding CNAME record.

For the detailed domain addition process, see the domain name management document.

By completing the above steps, you have successfully migrated your Cloudflare Pages project to EdgeOne Pages. The two platforms have similarities in some aspects, but on a strong infrastructure, we have optimized Pages product features, such as intelligent refresh preheating, to deliver an out-of-the-box experience. In addition, Pages has fewer restrictions compared to competitors during the beta phase, providing more flexibility for developers. In terms of customer support, we provide more timely responses, committed to providing developers with a high-quality product experience.

If you encounter any issues during migration, please refer to the EdgeOne Pages Documentation.

ai-agent
You can ask me like
How to Get Started with EdgeOne Pages?