Tutorial Tutorial Developer Platform Developer Platform ~10 phút ~10 min Đồng bộ 2026-06-10 Synced 2026-06-10

Di chuyển từ Netlify to Workers Migrate from Netlify to Workers

Hướng dẫn chi tiết đồng bộ từ docs Cloudflare — mỗi section có backlink tới đúng vị trí trên trang gốc. Detailed guide synced from Cloudflare docs — each section links to the matching anchor on the official page.

← Danh mục ← Catalog

Giải thích nhanh Quick context

Thuộc Developer Platform — thực hành triển khai code, API và dữ liệu trên edge/serverless. Tutorial «Di chuyển từ Netlify to Workers» giúp bạn làm quen luồng triển khai thật — phù hợp đọc trước khi mở tài liệu gốc tiếng Anh. Đọc phần tóm tắt và lưu ý trước — sau đó mở docs gốc để copy lệnh và cấu hình chi tiết.

Migrate your Netlify application to Cloudflare Workers. You should already have an existing project deployed on Netlified that you would like to host on Workers.

Lưu ý trước khi làm Notes before you start

  • Đây là bản tóm tắt trên Orange Cloud Learning Hub — không thay thế tài liệu chính thức. This is a summary on Orange Cloud Learning Hub — it does not replace the official documentation.
  • Luôn mở liên kết «Tài liệu gốc» bên dưới khi cần lệnh CLI, snippet code và ảnh minh họa đầy đủ. Open the Official docs link below for CLI commands, code snippets, and full screenshots.
  • Cần tài khoản Cloudflare, Wrangler CLI và (thường) hoàn thành hướng dẫn Get started của Workers/Pages. Requires a Cloudflare account, Wrangler CLI, and (typically) completing the Workers/Pages Get started guide.
  • Docs Cloudflare cập nhật thường xuyên — đối chiếu ngày «Rà soát lần cuối» trên trang gốc khi triển khai production. Cloudflare docs change frequently — verify the Last reviewed date on the official page before production use.

Tài liệu gốc — rà soát lần cuối: about 1 year ago Official docs — last reviewed: about 1 year ago

Tổng quan Overview

Trong tutorial này, bạn sẽ migrate your Netlify application to Cloudflare Workers.

Read the "Overview" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

In this tutorial, you will learn how to migrate your Netlify application to Cloudflare Workers.

You should already have an existing project deployed on Netlify that you would like to host on Cloudflare Workers. Netlify specific features are not supported by Cloudflare Workers. Review the Workers compatibility matrix for more information on what is supported.

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)

Frameworks Frameworks

Phần «Frameworks» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Frameworks" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

Some frameworks like Next.js, Astro with on demand rendering, and others have specific guides for migrating to Cloudflare Workers. Refer to our framework guides for more information. If your framework has a Deploy an existing project on Workers guide, follow that guide for specific instructions. Otherwise, continue with the steps below.

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)

Find your build command và build directory Find your build command and build directory

Phần «Find your build command và build directory» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Find your build command and build directory" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

To move your application to Cloudflare Workers, you will need to know your build command and build directory. Cloudflare Workers will use this information to build and deploy your application. We will cover how to find these values in the Netlify Dashboard below.

In your Netlify Dashboard, find the project you want to migrate to Workers. Go to the Project configuration menu for your specific project, then go into the Build & deploy menu item. You will find a Build settings card that includes the Build command and Publish directory fields. Save these for deploying to Cloudflare Workers. In the below image, the Build Command is npm run build, and the Output Directory is .next.

Tạo wrangler file Create a wrangler file

Phần «Tạo wrangler file» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Create a wrangler file" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

In the root of your project, create a wrangler.jsonc or wrangler.toml file (wrangler.jsonc is recommended). What goes in the file depends on what type of application you are deploying: an application powered by Static Site Generation (SSG), or a Single Page Application (SPA).

For each case, be sure to update the <your-project-name> value with the name of your project and <your-build-directory> value with the build directory from Netlify.

For a static site, you will need to add the following to your wrangler file.

JSONC

text
{

  "name": "<your-project-name>",

  // Set this to today's date

  "compatibility_date": "2026-06-10",

  "assets": {

    "directory": "<your-build-directory>",

  },

}

TOML

text
name = "<your-project-name>"

# Set this to today's date

compatibility_date = "2026-06-10"


[assets]

directory = "<your-build-directory>"

For a Single Page Application, you will need to add the following to your Wrangler configuration file, which includes the notfoundhandling field.

JSONC

text
{

  "name": "<your-project-name>",

  // Set this to today's date

  "compatibility_date": "2026-06-10",

  "assets": {

    "directory": "<your-build-directory>",

    "not_found_handling": "single-page-application",

  },

}

TOML

text
name = "<your-project-name>"

# Set this to today's date

compatibility_date = "2026-06-10"


[assets]

directory = "<your-build-directory>"

not_found_handling = "single-page-application"

Some frameworks provide specific guides for migrating to Cloudflare Workers. Please refer to our framework guides for more information. If your framework includes a “Deploy an existing project on Workers” guide, follow it for detailed instructions.

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)

Tạo Workers dự án mới Create a new Workers project

Phần «Tạo Workers dự án mới» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Create a new Workers project" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

Your application has the proper configuration to be built and deployed to Cloudflare Workers.

The Connect a new Worker guide will instruct you how to connect your GitHub project to Cloudflare Workers. In the configuration step, ensure your build command is the same as the command you found on Netlify. Also, the deploy command should be the default npx wrangler deploy.

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)

Thêm custom domain Add a custom domain

Phần «Thêm custom domain» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Add a custom domain" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

Workers Custom Domains only supports domains that are configured as zones on your account. A zone refers to a domain (such as example.com) that Cloudflare manages for you, including its DNS and traffic.

Follow these instructions for adding a custom domain to your Workers project. You will also find additional information on creating a zone for your domain.

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)

Xó your Netlify app Delete your Netlify app

Phần «Xó your Netlify app» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Delete your Netlify app" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

Once your custom domain is set up and sending requests to Cloudflare Workers, you can safely delete your Netlify application.

Xử lý sự cố Troubleshooting

Phần «Xử lý sự cố» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Troubleshooting" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

For additional migration instructions, review the Cloudflare Pages to Workers migration guide. While not Netlify specific, it does cover some additional steps that may be helpful.

json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/workers/","name":"Workers"}},{"@type":"ListItem","position":3,"item":{"@id":"/workers/static-assets/","name":"Static Assets"}},{"@type":"ListItem","position":4,"item":{"@id":"/workers/static-assets/migration-guides/","name":"Migration Guides"}},{"@type":"ListItem","position":5,"item":{"@id":"/workers/static-assets/migration-guides/netlify-to-workers/","name":"Migrate from Netlify to Workers"}}]}

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)

Xem bản đầy đủ trên developers.cloudflare.com (ảnh, tab cấu hình). View the full guide on developers.cloudflare.com (images, config tabs).

Tài liệu gốc ↗ Official docs ↗