Skip to content

Commit 2ffd46d

Browse files
i18n(ja): update integrations-guide/vercel.mdx (#14008)
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
1 parent c37d2fc commit 2ffd46d

1 file changed

Lines changed: 33 additions & 37 deletions

File tree

  • src/content/docs/ja/guides/integrations-guide

src/content/docs/ja/guides/integrations-guide/vercel.mdx

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -413,22 +413,51 @@ export default defineConfig({
413413
});
414414
```
415415

416+
### `staticHeaders`
417+
418+
<p>
419+
**Type:** `boolean`<br/>
420+
**Default:** `false`<br />
421+
**Available for:** Serverless <br/>
422+
<Since pkg="@astrojs/vercel" v="10.0.0" />
423+
</p>
424+
425+
Vercelの設定で事前レンダリングされたページのカスタムヘッダーを指定できるようにします。
426+
427+
有効にすると、アダプターはコンテンツセキュリティポリシーなどのAstroの機能によって提供された[静的ヘッダーをVercelの`vercel.json`ファイル](https://vercel.com/docs/project-configuration#headers)に保存します。
428+
429+
たとえば、[Content Security Policyの設定](/ja/reference/configuration-reference/#securitycsp)を有効にしている場合、`staticHeaders`を使用して、`<meta>`要素を作成する代わりにCSP`headers`をVercel設定に追加できます。
430+
431+
```js title="astro.config.mjs" {9}
432+
import { defineConfig } from 'astro/config';
433+
import vercel from '@astrojs/vercel';
434+
435+
export default defineConfig({
436+
security: {
437+
csp: true
438+
},
439+
adapter: vercel({
440+
staticHeaders: true
441+
})
442+
});
443+
```
444+
416445
### Vercel Edge FunctionsでAstroミドルウェアを実行する
417446

418-
`@astrojs/vercel`アダプターは、コードベース内のAstroミドルウェアから[Edge functions](https://vercel.com/docs/functions/edge-functions)を作成できます。`edgeMiddleware`が有効になっている場合、エッジ関数は、静的アセット、事前レンダリングされたページ、オンデマンドでレンダリングされたページを含むすべてのリクエストに対してミドルウェアコードを実行します。
447+
`@astrojs/vercel`アダプターは、コードベース内のAstroミドルウェアから[Edge functions](https://vercel.com/docs/functions/edge-functions)を作成できます。[`middlewareMode`](/ja/reference/adapter-reference/#middlewaremode)`'edge'`に設定されている場合、エッジ関数は、静的アセット、事前レンダリングされたページ、オンデマンドでレンダリングされたページを含むすべてのリクエストに対してミドルウェアコードを実行します。
419448

420449
オンデマンドでレンダリングされたページの場合、`context.locals`オブジェクトはJSONを使用してシリアル化され、レンダリングを実行するサーバーレス関数にヘッダーで送信されます。セキュリティ対策として、サーバーレス関数は、生成されたエッジ関数からのリクエストでない限り、`403 Forbidden`レスポンスでリクエストを拒否します。
421450

422-
これはオプトイン機能です。有効にするには、`edgeMiddleware``true`に設定します。
451+
これはオプトイン機能です。有効にするには、`middlewareMode``'edge'`に設定します。
423452

424-
```js title="astro.config.mjs" "edgeMiddleware: true"
453+
```js title="astro.config.mjs" "middlewareMode: 'edge'"
425454
import { defineConfig } from 'astro/config';
426455
import vercel from '@astrojs/vercel';
427456

428457
export default defineConfig({
429458
// ...
430459
adapter: vercel({
431-
edgeMiddleware: true,
460+
middlewareMode: 'edge',
432461
}),
433462
});
434463
```
@@ -505,37 +534,4 @@ Vercelでセッションを使用する場合、セッションストレージ
505534

506535
詳細は[Vercelのドキュメント](https://vercel.com/docs/functions/serverless-functions/runtimes/node-js#default-and-available-versions)をご覧ください。
507536

508-
## 実験的な機能
509-
510-
以下の機能も利用可能ですが、将来のアップデートで破壊的な変更が加えられる可能性があります。この機能をプロジェクトで使用している場合は、[`@astrojs/vercel` CHANGELOG](https://github.com/withastro/astro/tree/main/packages/integrations/vercel/CHANGELOG.md)で更新情報を確認してください。
511-
512-
### `experimentalStaticHeaders`
513-
514-
<p>
515-
**Type:** `boolean`<br/>
516-
**Default:** `false`<br />
517-
**Available for:** Serverless <br/>
518-
<Since pkg="@astrojs/vercel" v="8.2.0" />
519-
</p>
520-
521-
Vercelの設定で事前レンダリングされたページのカスタムヘッダーを指定できるようにします。
522-
523-
有効にすると、アダプターはコンテンツセキュリティポリシーなどのAstroの機能によって提供された[静的ヘッダーをVercelの`vercel.json`ファイル](https://vercel.com/docs/project-configuration#headers)に保存します。
524-
525-
たとえば、[CSP設定](/ja/reference/configuration-reference/)を有効にしている場合、`experimentalStaticHeaders`を使用して、`<meta>`要素を作成する代わりにCSP`headers`をVercel設定に追加できます。
526-
527-
```js title="astro.config.mjs" {9}
528-
import { defineConfig } from 'astro/config';
529-
import vercel from '@astrojs/vercel';
530-
531-
export default defineConfig({
532-
security: {
533-
csp: true
534-
},
535-
adapter: vercel({
536-
experimentalStaticHeaders: true
537-
})
538-
});
539-
```
540-
541537
[astro-integration]: /ja/guides/integrations/

0 commit comments

Comments
 (0)