Skip to content

Commit 1591650

Browse files
committed
Migration guide for Pages -> Workers
1 parent 6762451 commit 1591650

File tree

13 files changed

+423
-147
lines changed

13 files changed

+423
-147
lines changed

public/__redirects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,7 @@
15231523
/workers/tutorials/create-sitemap-from-sanity-cms/ /developer-spotlight/tutorials/create-sitemap-from-sanity-cms/ 301
15241524
/workers/tutorials/custom-access-control-for-files-in-r2-using-d1-and-workers/ /developer-spotlight/tutorials/custom-access-control-for-files/ 301
15251525
/workers/tutorials/generate-dynamic-og-images-using-workers/ /workers/tutorials/ 302
1526+
/workers/static-assets/compatibility-matrix/ /workers/static-assets/migrate-from-pages/ 301
15261527

15271528
# workers ai
15281529
/workers-ai/models/llm/ /workers-ai/models/#text-generation 301
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
pcx_content_type: navigation
3+
title: Migrate to Workers
4+
external_link: /workers/static-assets/migrate-from-pages/
5+
---

src/content/docs/pages/migrations/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ type: overview
33
pcx_content_type: navigation
44
title: Migration guides
55
sidebar:
6+
hidden: true
67
order: 4
7-
88
---
99

10-
import { DirectoryListing } from "~/components"
10+
import { DirectoryListing } from "~/components";
1111

1212
<DirectoryListing />

src/content/docs/pages/migrations/migrating-from-firebase.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ updated: 2020-09-28
33
difficulty: Beginner
44
pcx_content_type: tutorial
55
title: Migrating from Firebase
6+
sidebar:
7+
hidden: true
68
---
79

810
In this tutorial, you will learn how to migrate an existing Firebase application to Cloudflare Pages. You should already have an existing project deployed on Firebase that you would like to host on Cloudflare Pages.

src/content/docs/pages/migrations/migrating-from-netlify/index.mdx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ pcx_content_type: tutorial
55
title: Migrating from Netlify to Pages
66
languages:
77
- JavaScript
8-
8+
sidebar:
9+
hidden: true
910
---
1011

1112
In this tutorial, you will learn how to migrate your Netlify application to Cloudflare Pages.
@@ -36,10 +37,8 @@ Your header files can also be moved into a `_headers` folder in your publish dir
3637

3738
:::note
3839

39-
4040
Redirects execute before headers. In the case of a request matching rules in both files, the redirect will take precedence.
4141

42-
4342
:::
4443

4544
## Forms
@@ -60,19 +59,18 @@ Hello World with Netlify functions:
6059

6160
```js
6261
exports.handler = async function (event, context) {
63-
return {
64-
statusCode: 200,
65-
body: JSON.stringify({ message: "Hello World" }),
66-
};
67-
}
68-
62+
return {
63+
statusCode: 200,
64+
body: JSON.stringify({ message: "Hello World" }),
65+
};
66+
};
6967
```
7068

7169
Hello World with Pages Functions:
7270

7371
```js
7472
export async function onRequestPost(request) {
75-
return new Response(`Hello world`);
73+
return new Response(`Hello world`);
7674
}
7775
```
7876

src/content/docs/pages/migrations/migrating-from-vercel/index.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ updated: 2020-09-23
33
difficulty: Beginner
44
pcx_content_type: tutorial
55
title: Migrating from Vercel to Pages
6-
6+
sidebar:
7+
hidden: true
78
---
89

910
In this tutorial, you will learn how to deploy your Vercel application to Cloudflare Pages.
1011

1112
:::note
1213

13-
1414
You should already have an existing project deployed on Vercel that you would like to host on Cloudflare Pages. Features such as Vercel's serverless functions are currently not supported in Cloudflare Pages.
1515

16-
1716
:::
1817

1918
## Finding your build command and build directory
@@ -44,12 +43,10 @@ To use a custom domain for your Pages project, [add a custom domain](/pages/conf
4443

4544
:::note
4645

47-
4846
Cloudflare does not provide IP addresses for your Pages project because we do not require `A` or `AAAA` records to link your domain to your project. Instead, Cloudflare uses `CNAME` records.
4947

5048
For more details, refer to [Custom domains](/pages/configuration/custom-domains/).
5149

52-
5350
:::
5451

5552
## Cleaning up your old application and assigning the domain

src/content/docs/pages/migrations/migrating-from-workers/index.mdx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ updated: 2020-08-13
33
difficulty: Beginner
44
pcx_content_type: tutorial
55
title: Migrating from Workers Sites to Pages
6-
6+
sidebar:
7+
hidden: true
78
---
89

910
In this tutorial, you will learn how to migrate an existing [Cloudflare Workers Sites](/workers/configuration/sites/) application to Cloudflare Pages.
@@ -16,10 +17,8 @@ You may already have a reasonably complex Worker and/or it would be tedious to s
1617

1718
:::note
1819

19-
2020
When using a `_worker.js` file, the entire `/functions` directory is ignored - this includes its routing and middleware characteristics. Instead, the `_worker.js` file is deployed as is and must be written using the [Module Worker syntax](/workers/reference/migrate-to-module-workers/).
2121

22-
2322
:::
2423

2524
By migrating to Cloudflare Pages, you will be able to access features like [preview deployments](/pages/configuration/preview-deployments/) and automatic branch deploys with no extra configuration needed.
@@ -40,12 +39,10 @@ You can migrate your redirects to Pages, by creating a `_redirects` file in your
4039

4140
:::note
4241

43-
4442
A project is limited to 2,000 static redirects and 100 dynamic redirects, for a combined total of 2,100 redirects. Each redirect declaration has a 1,000-character limit. Malformed definitions are ignored. If there are multiple redirects for the same source path, the topmost redirect is applied.
4543

4644
Make sure that static redirects are before dynamic redirects in your `_redirects` file.
4745

48-
4946
:::
5047

5148
In addition to a `_redirects` file, Cloudflare also offers [Bulk Redirects](/pages/configuration/redirects/#surpass-_redirects-limits), which handles redirects that surpasses the 2,100 redirect rules limit set by Pages.
@@ -62,10 +59,8 @@ If you choose to use a custom domain for your Pages project, you can set it to t
6259

6360
:::note
6461

65-
6662
Before you deploy, you will need to delete your old Workers routes to start sending requests to Cloudflare Pages.
6763

68-
6964
:::
7065

7166
### Using Direct Upload

src/content/docs/pages/migrations/migrating-jekyll-from-github-pages.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ pcx_content_type: tutorial
55
title: Migrating a Jekyll-based site from GitHub Pages
66
languages:
77
- Ruby
8+
sidebar:
9+
hidden: true
810
---
911

1012
In this tutorial, you will learn how to migrate an existing [GitHub Pages site using Jekyll](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll) to Cloudflare Pages. Jekyll is one of the most popular static site generators used with GitHub Pages, and migrating your GitHub Pages site to Cloudflare Pages will take a few short steps.

src/content/docs/workers/static-assets/compatibility-matrix.mdx

Lines changed: 0 additions & 98 deletions
This file was deleted.

src/content/docs/workers/static-assets/direct-upload.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: concept
33
title: Direct Uploads
44
sidebar:
5-
order: 7
5+
order: 6
66
head: []
77
description: Upload assets through the Workers API.
88
---

0 commit comments

Comments
 (0)