ファランクスブログ
仕事-お問い合わせ© ファランクスブログGitHub avatar

Written by

Mr-Pontaman

  1. blog
  2. next-api-protection-key
  • *CORS:保護というよりも「許可」
  • サーバーからのfetch
  • next.config.tsでの設定
  • 1 . APIキーによる保護
  • A . Authorization: Bearerの例
  • 環境変数を作成
  • route.ts
  • fetch
  • B . x-api-keyの例
  • 環境変数を作成
  • route.ts
  • fetch
  • 2 . APIを経由しない

Nextjs:APIルートの保護 / CORSの理解

2026年1月11日
nextjssecurity
  • *CORS:保護というよりも「許可」
  • サーバーからのfetch
  • next.config.tsでの設定
  • 1 . APIキーによる保護
  • A . Authorization: Bearerの例
  • 環境変数を作成
  • route.ts
  • fetch
  • B . x-api-keyの例
  • 環境変数を作成
  • route.ts
  • fetch
  • 2 . APIを経由しない