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
<ReadMore>MDX 항목을 다룰 때, [사용자 정의 컴포넌트를 `<Content />`에 전달](/ko/guides/integrations-guide/mdx/#components를-mdx-콘텐츠로-전달하기)하여 HTML 요소를 사용자 정의 대안으로 대체할 수도 있습니다.</ReadMore>
프런트엔드 정적 자산과 백엔드 API를 포함한 풀스택 애플리케이션뿐만 아니라 요청 시 렌더링되는 사이트까지 [Cloudflare Workers](https://developers.cloudflare.com/workers/static-assets/) 및 [Cloudflare Pages](https://pages.cloudflare.com/)에 배포할 수 있습니다.
14
15
@@ -45,46 +46,53 @@ Astro 프로젝트에서 [Cloudflare 런타임을 사용하는 방법](/ko/guide
45
46
46
47
이 명령어는 어댑터를 설치하고 `astro.config.mjs` 파일에 필요한 변경 사항을 한 번에 적용합니다.
47
48
48
-
```bash
49
+
<PackageManagerTabs>
50
+
<Fragmentslot="npm">
51
+
```sh
49
52
npx astro add cloudflare
50
53
```
51
-
52
-
그런 다음 `public/` 폴더에 `.assetsignore` 파일을 만들고 다음 줄을 추가하세요.
53
-
```txt title="public/.assetsignore"
54
-
_worker.js
55
-
_routes.json
54
+
</Fragment>
55
+
<Fragmentslot="pnpm">
56
+
```sh
57
+
pnpm astro add cloudflare
58
+
```
59
+
</Fragment>
60
+
<Fragmentslot="yarn">
61
+
```sh
62
+
yarn astro add cloudflare
56
63
```
64
+
</Fragment>
65
+
</PackageManagerTabs>
57
66
58
67
<ReadMore>[Astro의 요청 시 렌더링](/ko/guides/on-demand-rendering/)에 대해 더 자세히 알아보세요.</ReadMore>
59
68
60
69
3.[Wrangler 구성 파일](https://developers.cloudflare.com/workers/wrangler/configuration/)을 생성합니다.
70
+
71
+
`astro add cloudflare` 명령어를 실행하면 이 파일이 자동으로 생성됩니다. 어댑터를 사용하지 않는 경우 직접 생성해야 합니다.
2. 사이트에서 요청 시 렌더링을 사용하는 경우, [`@astrojs/cloudflare` 어댑터](/ko/guides/integrations-guide/cloudflare/)를 설치합니다.
149
171
150
172
이 명령어는 어댑터를 설치하고 `astro.config.mjs` 파일에 필요한 변경 사항을 한 번에 적용합니다.
151
173
152
-
```bash
153
-
npx astro add cloudflare
174
+
<PackageManagerTabs>
175
+
<Fragmentslot="npm">
176
+
```sh
177
+
npx astro add cloudflare
178
+
```
179
+
</Fragment>
180
+
<Fragmentslot="pnpm">
181
+
```sh
182
+
pnpm astro add cloudflare
183
+
```
184
+
</Fragment>
185
+
<Fragmentslot="yarn">
186
+
```sh
187
+
yarn astro add cloudflare
188
+
```
189
+
</Fragment>
190
+
</PackageManagerTabs>
191
+
192
+
3.[Wrangler 구성 파일](https://developers.cloudflare.com/workers/wrangler/configuration/)을 생성합니다.
193
+
194
+
Cloudflare는 신규 프로젝트에 Pages 대신 Workers를 사용할 것을 권장하므로, `astro add cloudflare` 명령은 Workers 프로젝트에 특화된 `wrangler.jsonc` 및 `public/.assetsignore` 파일을 생성합니다. 그래서 `public/.assetsignore` 파일을 삭제하고 `wrangler.jsonc` 파일을 수정해야 합니다. 어댑터를 사용하지 않는다면 직접 생성해야 합니다.
자산이 업로드되면 Wrangler는 사이트를 검사할 수 있는 미리보기 URL을 제공합니다.
171
267
172
-
### Git을 사용하여 사이트를 배포하는 방법
268
+
### CI/CD를 사용하여 사이트를 배포하는 방법
173
269
174
270
<Steps>
175
271
1. 코드를 git 리포지토리 (예: GitHub, GitLab)에 푸시합니다.
@@ -186,6 +282,21 @@ Workers Builds를 사용하는 경우:
186
282
187
283
## 문제 해결
188
284
285
+
### 404 동작
286
+
287
+
Workers 프로젝트에서 사용자 정의 404 페이지를 제공하려면 `not_found_handling`을 설정해야 합니다. Cloudflare 문서의 [라우팅 동작 섹션](https://developers.cloudflare.com/workers/static-assets/#routing-behavior)에서 이에 대해 더 자세히 알아볼 수 있습니다.
288
+
289
+
```jsonc title="wrangler.jsonc"
290
+
{
291
+
"assets": {
292
+
"directory":"./dist",
293
+
"not_found_handling":"404-page"
294
+
}
295
+
}
296
+
```
297
+
298
+
Pages 프로젝트에서 사용자 정의 404 페이지를 포함하면 해당 페이지가 기본적으로 제공됩니다. 그렇지 않으면 Pages는 [Cloudflare의 단일 페이지 애플리케이션 렌더링 동작](https://developers.cloudflare.com/pages/configuration/serving-pages/#single-page-application-spa-rendering)을 기본값으로 사용하고 404 페이지를 표시하는 대신 홈 페이지로 리디렉션합니다.
299
+
189
300
### 클라이언트 측 수화
190
301
191
302
Cloudflare의 Auto Minify 설정으로 인해 클라이언트 측 하이드레이션이 실패할 수 있습니다. 콘솔에 `Hydration completed but contains mismatches`가 표시되면 Cloudflare 설정에서 Auto Minify를 비활성화하세요.
0 commit comments