Skip to content

fix: handle OPTIONS preflight requests#447

Draft
SsuJojo wants to merge 1 commit into
devfrom
fix/options-preflight-get-endpoints
Draft

fix: handle OPTIONS preflight requests#447
SsuJojo wants to merge 1 commit into
devfrom
fix/options-preflight-get-endpoints

Conversation

@SsuJojo
Copy link
Copy Markdown
Collaborator

@SsuJojo SsuJojo commented May 6, 2026

Summary

  • Add a global OPTIONS handler for browser/client preflight requests
  • Return CORS preflight headers before normal route middleware, covering GET endpoints like /v1/models

Test plan

  • Not run per request

@SsuJojo SsuJojo marked this pull request as draft May 6, 2026 15:31
@icebear0828
Copy link
Copy Markdown
Owner

Review notes:

这个改动整体低风险,我没有看到 blocker。两个小建议可以考虑顺手补:

  1. Vary 建议包含 Access-Control-Request-Method;preflight 响应也会受 request method 影响。
  2. 当前 app.options("*") 放在 requestId/logger 等全局 middleware 前,所以 preflight 不会进入统一 request id / logging。如果项目希望所有请求都有日志,可以调整顺序;如果是刻意让 preflight 更轻量,也可以保持现状。

这两个都不是阻塞问题。

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.

2 participants