Skip to content

docs: CORS + Auth ミドルウェア登録順ルール (#90)#92

Merged
hideyukiMORI merged 1 commit into
mainfrom
docs/issue-90-cors-auth-middleware-order
May 19, 2026
Merged

docs: CORS + Auth ミドルウェア登録順ルール (#90)#92
hideyukiMORI merged 1 commit into
mainfrom
docs/issue-90-cors-auth-middleware-order

Conversation

@hideyukiMORI
Copy link
Copy Markdown
Owner

Summary

  • docs/reference/framework-modules.md に完全なミドルウェア登録順コード例を追加(add_middleware 引数テーブル・CORS+Auth callout 含む)
  • docs/ja/reference/framework-modules.md に同内容の日本語版を追加
  • docs/how-to/new-project.md に Auth + CORS ミドルウェアのコード例と CORS+Auth ルールの callout を追加

Background

FT4(snippets: ApiKey + CORS)で発見した摩擦 F-1。
CORSMiddleware と ApiKeyAuthMiddleware を同時使用した際、CORSMiddleware を先に登録すると Auth が最外側になり OPTIONS preflight が 401 になる。
Starlette の逆順ルール(後に登録 = 最外側)の組み合わせ固有の説明が不足していたため追記。

Test plan

  • ruff check / format — OK
  • mypy --strict — OK
  • ドキュメント EN + JA の両方を更新

Closes #90

🤖 Generated with Claude Code

CORS と Auth を同時使用する場合、CORSMiddleware を Auth より後に登録して
最外側に置かないと OPTIONS preflight が 401 になる問題をドキュメント化。
framework-modules.md(EN/JA)と new-project.md に完全な登録順コード例と
CORS + Auth ルールの callout を追加。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hideyukiMORI hideyukiMORI merged commit eeef4b2 into main May 19, 2026
1 check passed
@hideyukiMORI hideyukiMORI deleted the docs/issue-90-cors-auth-middleware-order branch May 19, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: CORS + Auth同時使用時のミドルウェア登録順を明記 (FT4-F1)

1 participant