Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/content/docs/ko/guides/integrations-guide/cloudflare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Cloudflare 어댑터는 [`@cloudflare/vite-plugin`](https://developers.cloudflar
### `imageService`

<p>
**타입:** `'passthrough' | 'cloudflare' | 'cloudflare-binding' | 'compile' | 'custom' | { build: 'compile', runtime?: 'cloudflare-binding' | 'passthrough' }`<br />
**타입:** `'passthrough' | 'cloudflare' | 'cloudflare-binding' | 'compile' | 'custom' | { build: 'compile' | 'cloudflare-binding', runtime?: 'cloudflare-binding' | 'passthrough' }`<br />
**기본값:** `'cloudflare-binding'`
</p>

Expand All @@ -128,8 +128,11 @@ Cloudflare 어댑터는 [`@cloudflare/vite-plugin`](https://developers.cloudflar
- **`compile`:** [구성된 이미지 서비스](/ko/reference/configuration-reference/#imageservice)를 사용하거나, 이미지 서비스가 구성되지 않은 경우 내부 의존성을 조합하여 사전 렌더링 경로의 이미지를 빌드 시점에 로컬에서 변환합니다. 주문형 렌더링 페이지에서는 아무 작업도 수행하지 않는 `passthrough` 옵션이 사용됩니다.
- **`custom`:** [구성된 이미지 서비스](/ko/reference/configuration-reference/#imageservice)(기본값: Sharp)를 사용하여 사전 렌더링 경로의 에셋을 빌드 시점에 처리합니다. 또한 런타임 이미지 처리를 위해 이미지 서비스를 번들에 포함하지만, 해당 서비스가 Cloudflare의 `workerd` 런타임과 호환되는지는 검사하지 않습니다.

<p><Since v="14.2.0" pkg="@astrojs/cloudflare" /></p>

이미지 서비스를 객체로 구성하여 빌드 시점 서비스와 런타임 서비스를 각각 독립적으로 설정할 수도 있습니다. 현재 빌드 시점 옵션으로는 `'compile'`만 사용할 수 있습니다. 지원되는 런타임 옵션은 `'passthrough'` (기본값) 및 `'cloudflare-binding'`입니다.
이미지 서비스를 객체로 구성하여 빌드 시점 서비스(`compile` 또는 `cloudflare-binding`)와 선택적으로 런타임 서비스(`passthrough` 또는 `cloudflare-binding`)를 지정할 수도 있습니다.

런타임 서비스를 지정하지 않으면 빌드 시점 서비스에 따라 기본 런타임 서비스가 선택됩니다. `build: 'compile'`에는 `'passthrough'`가, `build: 'cloudflare-binding'`에는 `'cloudflare-binding'`이 기본값으로 사용됩니다.

```js title="astro.config.mjs" ins={6}
import { defineConfig } from 'astro/config';
Expand All @@ -142,6 +145,21 @@ export default defineConfig({
});
```

`imageService: 'cloudflare-binding'`을 사용하면 런타임에만 [Cloudflare Images 바인딩](https://developers.cloudflare.com/images/transform-images/bindings/)으로 이미지를 최적화할 수 있습니다.

`workerd`에서 사전 렌더링하는 동안에도 바인딩을 사용해 빌드 시점 이미지 최적화를 수행하려면 `build`를 `'cloudflare-binding'`으로 설정하세요. 바인딩이 빌드 시점에 이미지를 변환하지 못하면 어댑터는 [구성된 이미지 서비스](/ko/reference/configuration-reference/#imageservice)(기본값: Sharp)로 대체합니다.

```js title="astro.config.mjs" ins={6}
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';

export default defineConfig({
adapter: cloudflare({
imageService: { build: 'cloudflare-binding', runtime: 'cloudflare-binding' }
}),
});
```

### `sessionKVBindingName`

<p>
Expand Down Expand Up @@ -353,6 +371,8 @@ const cart = await Astro.session?.get('cart');

기본적으로 KV 바인딩 이름은 `SESSION`입니다. 다른 이름을 사용하려면 어댑터 구성에서 [`sessionKVBindingName`](#sessionkvbindingname) 옵션을 설정하세요.

프로젝트에서 세션을 사용하지 않는 경우 Astro 구성에서 [`session: false`](/ko/guides/sessions/#세션-비활성화)를 설정할 수 있습니다. 어댑터는 KV 바인딩을 구성하지 않으며, 배포 시 KV 네임스페이스도 프로비저닝하지 않습니다. 또한 세션 런타임이 Worker 번들에서 제외됩니다.

:::note
Cloudflare KV에 대한 쓰기는 리전 간에 [결과적 일관성](https://developers.cloudflare.com/kv/concepts/how-kv-works/#consistency)을 갖습니다. 즉, 동일한 리전 내에서는 변경 사항을 즉시 사용할 수 있지만 전 세계적으로 전파되는 데 최대 60초가 걸릴 수 있습니다. 대부분의 사용자는 요청 사이에 리전을 전환할 가능성이 낮으므로 영향을 받지 않지만, VPN 사용자 등 일부 사용 사례에서는 고려 사항이 될 수 있습니다.
:::
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/ko/guides/integrations-guide/netlify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ export default defineConfig({

Netlify 어댑터를 사용하는 경우 Astro는 세션 스토리지를 위해 [Netlify Blobs](https://docs.netlify.com/blobs/overview/)를 자동으로 구성합니다. 다른 세션 스토리지 드라이버를 사용하려면 Astro 구성에서 지정할 수 있습니다. 자세한 내용은 [`session` 구성 참조](/ko/reference/configuration-reference/#sessiondriver)를 확인하세요.

프로젝트에서 세션을 사용하지 않는 경우 Astro 구성에서 [`session: false`](/ko/guides/sessions/#세션-비활성화)를 설정할 수 있습니다. 어댑터는 Netlify Blobs를 세션 스토리지로 구성하지 않으며, 세션 런타임도 함수 번들에서 제외됩니다.

### 페이지 캐싱

동적 콘텐츠가 없는 주문형 렌더링 페이지를 캐시하여 성능을 향상하고 리소스 사용량을 줄일 수 있습니다.
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/ko/guides/integrations-guide/node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ Cache-Control: public, max-age=31536000, immutable

Node 어댑터를 사용하는 경우 Astro는 세션 스토리지를 위해 로컬 파일 시스템을 사용합니다. 다른 세션 스토리지 드라이버를 사용하려면 Astro 구성에서 지정할 수 있습니다. 자세한 내용은 [`session` 구성 참조](/ko/reference/configuration-reference/#sessiondriver)를 확인하세요.

프로젝트에서 세션을 사용하지 않는 경우 Astro 구성에서 [`session: false`](/ko/guides/sessions/#세션-비활성화)를 설정할 수 있습니다. 어댑터는 파일 시스템 세션 드라이버를 구성하지 않으며, 세션 런타임도 서버 번들에서 제외됩니다.

## 환경 변수

런타임 시 [`astro:env`](/ko/guides/environment-variables/#타입-안전-환경-변수) 비밀 또는 `process.env`를 사용할 경우, Astro나 어댑터 모두 환경 변수를 자동으로 로드하지 않습니다.
Expand Down
18 changes: 18 additions & 0 deletions src/content/docs/ko/guides/sessions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ export default defineConfig({
```
</Steps>

### 세션 비활성화

<p>
<Since v="7.2.0" />
</p>

세션 드라이버가 구성되지 않으면 세션 런타임은 서버 번들에서 자동으로 제외됩니다. `session: false`를 설정하면 어댑터가 기본 드라이버를 구성하지 않으므로 프로젝트에서 세션 지원을 완전히 비활성화할 수 있습니다.

```js title="astro.config.mjs" ins={4}
import { defineConfig } from 'astro/config';

export default defineConfig({
session: false,
});
```

기본 세션 드라이버를 제공하는 어댑터([Node](/ko/guides/integrations-guide/node/#세션), [Cloudflare](/ko/guides/integrations-guide/cloudflare/#세션), [Netlify](/ko/guides/integrations-guide/netlify/#세션) 등)도 드라이버를 구성하지 않습니다. 이는 서버리스 및 엣지 런타임에서 번들 크기를 줄여 콜드 스타트 시간을 단축하는 데 유용합니다.

## 세션 데이터와 상호작용

[`session` 객체](/ko/reference/api-reference/#session)를 사용하면 저장된 사용자 상태(예: 장바구니에 항목 추가) 및 세션 ID(예: 로그아웃 시 세션 ID 쿠키 삭제)와 상호 작용할 수 있습니다. 이 객체는 Astro 컴포넌트 및 페이지에서는 `Astro.session`으로, API 엔드포인트, 미들웨어 및 액션에서는 `context.session` 객체로 접근할 수 있습니다.
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/ko/reference/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -886,15 +886,15 @@ true인 경우 쿠키는 https 사이트에만 설정됩니다.

<p>

**타입:** `AstroSession`
**타입:** `AstroSession | undefined`

<Since v="5.7.0" />

</p>

[요청 시 렌더링되는 라우트](/ko/guides/on-demand-rendering/)에 대해 요청 간 데이터를 저장할 수 있게 해주는 객체가 바로 `session`입니다. 세션 자체의 데이터는 쿠키에 저장되지 않고, 세션 ID만 담고 있는 쿠키와 연결됩니다.

세션은 처음 사용될 때 생성되며, 세션 쿠키는 자동으로 설정됩니다. 세션 스토리지가 구성되지 않았거나 현재 라우트가 사전 렌더링된 경우에는 `session` 객체가 `undefined`가 되며, 이를 사용하려고 하면 오류가 기록됩니다.
세션은 처음 사용될 때 생성되며, 세션 쿠키는 자동으로 설정됩니다. 세션 스토리지가 구성되지 않았거나, [세션이 비활성화된](/ko/guides/sessions/#세션-비활성화) 경우 또는 현재 라우트가 사전 렌더링된 경우 `session` 객체는 `undefined`이며, 사용하면 오류가 기록됩니다.

Astro 프로젝트에서 세션을 사용하는 방법에 대한 더 자세한 내용은 [세션 가이드](/ko/guides/sessions/)를 참조하세요.

Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/ko/reference/modules/astro-fetch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ export default {
};
```

세션 드라이버가 구성되지 않았거나 [세션이 비활성화된](/ko/guides/sessions/#세션-비활성화) 경우에는 이 핸들러가 프로바이더를 등록하지 않습니다. 두 경우 모두 `ctx.session`은 `undefined`입니다.

### `trailingSlash()`

<p>
Expand Down
Loading