You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can deploy full-stack applications, including front-end static assets and back-end APIs, as well as on-demand rendered sites, to both [Cloudflare Workers](https://developers.cloudflare.com/workers/static-assets/) and [Cloudflare Pages](https://pages.cloudflare.com/).
16
+
You can deploy full-stack applications, including front-end static assets and back-end APIs, as well as on-demand rendered sites, to [Cloudflare Workers](https://developers.cloudflare.com/workers/static-assets/).
17
17
18
-
This guide includes:
19
-
20
-
-[How to deploy to Cloudflare Workers](#cloudflare-workers)
21
-
-[How to deploy to Cloudflare Pages](#cloudflare-pages)
22
18
23
19
:::note
24
20
@@ -125,14 +121,14 @@ After your assets are uploaded, Wrangler will give you a preview URL to inspect
125
121
126
122
### How to deploy with CI/CD
127
123
128
-
You can also use a CI/CD system such as [Workers Builds (BETA)](https://developers.cloudflare.com/workers/ci-cd/builds/) to automatically build and deploy your site on push.
124
+
You can also use a CI/CD system such as [Workers Builds](https://developers.cloudflare.com/workers/ci-cd/builds/) to automatically build and deploy your site on push.
129
125
130
126
If you're using Workers Builds:
131
127
132
128
<Steps>
133
129
1. Follow Steps 1-3 from the Wrangler section above.
134
130
135
-
2. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and navigate to `Workers & Pages`. Select `Create`.
131
+
2. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and navigate to `Compute > Workers & Pages`. Select `Create application`.
136
132
137
133
3. Under `Import a repository`, select a Git account and then the repository containing your Astro project.
138
134
@@ -143,144 +139,6 @@ If you're using Workers Builds:
143
139
5. Click `Save and Deploy`. You can now preview your Worker at its provided `workers.dev` subdomain.
2. If your site uses on-demand rendering, install the [`@astrojs/cloudflare` adapter](/en/guides/integrations-guide/cloudflare/).
172
-
173
-
This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.
174
-
175
-
<PackageManagerTabs>
176
-
<Fragmentslot="npm">
177
-
```sh
178
-
npx astro add cloudflare
179
-
```
180
-
</Fragment>
181
-
<Fragmentslot="pnpm">
182
-
```sh
183
-
pnpm astro add cloudflare
184
-
```
185
-
</Fragment>
186
-
<Fragmentslot="yarn">
187
-
```sh
188
-
yarn astro add cloudflare
189
-
```
190
-
</Fragment>
191
-
</PackageManagerTabs>
192
-
193
-
3. Create a [Wrangler configuration file](https://developers.cloudflare.com/workers/wrangler/configuration/).
194
-
195
-
Because Cloudflare recommends new projects use Workers instead of Pages, the `astro add cloudflare` command creates a `wrangler.jsonc` and `public/.assetsignore` file, which are specific to Workers projects. You will need to delete the `public/.assetsignore` file and change your `wrangler.jsonc` file. If you are not using the adapter you'll need to create it yourself.
196
-
197
-
Ensure your `wrangler.jsonc` file is structured like this:
198
-
199
-
<StaticSsrTabs>
200
-
<Fragmentslot="static">
201
-
```jsonc title="wrangler.jsonc"
202
-
{
203
-
"name":"my-astro-app",
204
-
"compatibility_date":"YYYY-MM-DD", // Update to the day you deploy
205
-
"pages_build_output_dir":"./dist"
206
-
}
207
-
```
208
-
</Fragment>
209
-
<Fragmentslot="ssr">
210
-
```jsonc title="wrangler.jsonc"
211
-
{
212
-
"name":"my-astro-app",
213
-
"compatibility_date":"YYYY-MM-DD", // Update to the day you deploy
214
-
"compatibility_flags": [
215
-
"nodejs_compat",
216
-
"disable_nodejs_process_v2"
217
-
],
218
-
"pages_build_output_dir":"./dist"
219
-
}
220
-
```
221
-
</Fragment>
222
-
</StaticSsrTabs>
223
-
224
-
<ReadMore>Read more about [on-demand rendering in Astro](/en/guides/on-demand-rendering/).</ReadMore>
225
-
226
-
3. Preview your project locally with Wrangler.
227
-
228
-
<PackageManagerTabs>
229
-
<Fragmentslot="npm">
230
-
```sh
231
-
npx astro build && wrangler pages dev ./dist
232
-
```
233
-
</Fragment>
234
-
<Fragmentslot="pnpm">
235
-
```sh
236
-
pnpm astro build && wrangler pages dev ./dist
237
-
```
238
-
</Fragment>
239
-
<Fragmentslot="yarn">
240
-
```sh
241
-
yarn astro build && wrangler pages dev ./dist
242
-
```
243
-
</Fragment>
244
-
</PackageManagerTabs>
245
-
246
-
4. Deploy using `npx wrangler deploy`.
247
-
248
-
<PackageManagerTabs>
249
-
<Fragmentslot="npm">
250
-
```sh
251
-
npx astro build && wrangler pages deploy ./dist
252
-
```
253
-
</Fragment>
254
-
<Fragmentslot="pnpm">
255
-
```sh
256
-
pnpm astro build && wrangler pages deploy ./dist
257
-
```
258
-
</Fragment>
259
-
<Fragmentslot="yarn">
260
-
```sh
261
-
yarn astro build && wrangler pages deploy ./dist
262
-
```
263
-
</Fragment>
264
-
</PackageManagerTabs>
265
-
</Steps>
266
-
267
-
After your assets are uploaded, Wrangler will give you a preview URL to inspect your site.
268
-
269
-
### How to deploy a site with CI/CD
270
-
271
-
<Steps>
272
-
1. Push your code to your git repository (e.g. GitHub, GitLab).
273
-
274
-
2. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and navigate to **Compute (Workers) > Workers & Pages**. Select **Create** and then select the **Pages** tab. Connect your git repository.
275
-
276
-
3. Configure your project with:
277
-
-**Framework preset**: `Astro`
278
-
-**Build command:**`npm run build`
279
-
-**Build output directory:**`dist`
280
-
281
-
4. Click the **Save and Deploy** button.
282
-
</Steps>
283
-
284
142
## Troubleshooting
285
143
286
144
### 404 behavior
@@ -296,8 +154,6 @@ For Workers projects, you will need to set `not_found_handling` if you want to s
296
154
}
297
155
```
298
156
299
-
For Pages projects, if you include a custom 404 page, it will be served by default. Otherwise, Pages will default to [Cloudflare's single-page application rendering behavior](https://developers.cloudflare.com/pages/configuration/serving-pages/#single-page-application-spa-rendering) and redirect to the home page instead of showing a 404 page.
300
-
301
157
### Client-side hydration
302
158
303
159
Client-side hydration may fail as a result of Cloudflare's Auto Minify setting. If you see `Hydration completed but contains mismatches` in the console, make sure to disable Auto Minify under Cloudflare settings.
The Cloudflare adapter deploys to Cloudflare Workers by default. To deploy to Cloudflare Pages instead, additional manual configuration is required.
434
-
435
-
:::caution
436
-
Cloudflare recommends using Workers for new projects. See Cloudflare's [migration guide from Pages to Workers](https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/) for more information if you have an existing project using Pages.
437
-
:::
438
-
439
-
<Steps>
440
-
1. Configure your build output directories in `astro.config.mjs`:
441
-
442
-
```js title="astro.config.mjs" ins={6-9}
443
-
import { defineConfig } from'astro/config';
444
-
importcloudflarefrom'@astrojs/cloudflare';
445
-
446
-
exportdefaultdefineConfig({
447
-
adapter:cloudflare(),
448
-
build: {
449
-
client:'./',
450
-
server:'./_worker.js',
451
-
},
452
-
});
453
-
```
454
-
455
-
2. Create a `_routes.json` file in your `public/` folder to route requests to your Worker:
456
-
457
-
```jsonc title="public/_routes.json"
458
-
{
459
-
"version":1,
460
-
"include": ["/*"], // Alternatively, specify specific routes
461
-
"exclude": ["/static/*"] // Exclude static assets if needed
462
-
}
463
-
```
464
-
465
-
See the [Cloudflare documentation on routing with Pages](https://developers.cloudflare.com/pages/functions/routing/#create-a-_routesjson-file) for more details.
466
-
</Steps>
467
-
468
431
## Upgrading to v13 and Astro 6
469
432
470
433
Astro 6 brings significant improvements to the Cloudflare development experience and requires `@astrojs/cloudflare` v13 or later. Now, `astro dev` uses Cloudflare's Vite plugin and `workerd` runtime to closely mirror production behavior.
Use `astro preview` to test your Cloudflare Workers application locally before deploying. The preview runs using Cloudflare's `workerd` runtime, closely mirroring production behavior. Run `astro build` followed by `astro preview` to start the preview server.
679
642
680
-
### Deprecated: Cloudflare Pages support
643
+
### Removed: Cloudflare Pages support
681
644
682
-
The Astro Cloudflare adapter now only supports deploying to Cloudflare Workers by default. If you are currently deploying to Cloudflare Pages, consider migrating to Workers for the best experience and feature support.
645
+
The Astro Cloudflare adapter no longer supports deployment on Cloudflare Pages. For the best experience and feature support, you should migrate to Cloudflare Workers.
683
646
684
647
<ReadMore>See Cloudflare's [migration guide from Pages to Workers](https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/) for detailed migration instructions.</ReadMore>
685
648
686
-
If you need to continue using Cloudflare Pages, see [Using with Cloudflare Pages](#using-with-cloudflare-pages) for the required manual configuration.
687
-
688
649
### Changed: `imageService` default
689
650
690
651
The default value of `imageService` has changed from `'compile'` to `'cloudflare-binding'` for an improved experience when working with images.
Copy file name to clipboardExpand all lines: src/content/docs/ko/guides/environment-variables.mdx
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,6 @@ Astro는 몇 가지 기본 환경 변수를 포함합니다.
58
58
-`import.meta.env.DEV`: 사이트가 개발 환경에서 실행 중이면 `true`, 그렇지 않으면 `false`입니다. 항상 `import.meta.env.PROD`의 반대입니다.
59
59
-`import.meta.env.BASE_URL`: 사이트가 제공되는 기본 URL입니다. [`base` 구성 옵션](/ko/reference/configuration-reference/#base)에 의해 결정됩니다.
60
60
-`import.meta.env.SITE`: 프로젝트의 `astro.config`에 지정된 [`site` 옵션](/ko/reference/configuration-reference/#site)으로 설정됩니다.
61
-
-`import.meta.env.ASSETS_PREFIX`: [`build.assetsPrefix` 구성 옵션](/ko/reference/configuration-reference/#buildassetsprefix)이 설정된 경우 Astro에서 생성된 자산 링크의 접두사입니다. Astro에서 처리하지 않는 자산 링크를 생성하는 데 사용할 수 있습니다.
62
61
63
62
다른 환경 변수처럼 사용하세요.
64
63
@@ -320,7 +319,7 @@ envField.enum({
320
319
})
321
320
```
322
321
323
-
<ReadMore>유효성 검사 필드의 전체 목록은 [`envField`API 참조](/ko/reference/configuration-reference/#envschema)를 확인하세요.</ReadMore>
322
+
<ReadMore>유효성 검사 필드의 전체 목록은 [`envField`API 참조](/ko/reference/modules/astro-config/)를 확인하세요.</ReadMore>
0 commit comments