Skip to content

fix: change /shorten-v2 from GET to POST to avoid 414 URI too long - #395

Open
v1vi4n wants to merge 1 commit into
7Sageer:mainfrom
v1vi4n:fix/shorten-v2-post
Open

fix: change /shorten-v2 from GET to POST to avoid 414 URI too long#395
v1vi4n wants to merge 1 commit into
7Sageer:mainfrom
v1vi4n:fix/shorten-v2-post

Conversation

@v1vi4n

@v1vi4n v1vi4n commented May 31, 2026

Copy link
Copy Markdown

问题

部署到 Cloudflare 后,/shorten-v2 API 因 URL 过长返回 414 错误。原因:订阅 URL(可能很长)通过 GET query string 传递,超出 Cloudflare 的请求 URI 限制。

改动

/shorten-v2 从 GET 改为 POST,URL 和 shortCode 通过 JSON body 传递:

  • 后端 (src/app/createApp.jsx): app.getapp.post,从 c.req.json() 读取参数
  • 前端 (src/components/formLogic.js): fetch 改为 POST + JSON body
  • 测试 (test/worker.test.js): 更新测试用例为 POST 请求

Cloudflare returns 414 when the URL (which embeds a full subscription URL
as query param) exceeds its request URI limit.  Moving the URL into the
JSON request body avoids this restriction.

- Backend: app.get → app.post, reads url/shortCode from c.req.json()
- Frontend: fetch with POST + JSON body instead of GET query string
- Test: updated to POST with JSON body
@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the 7sageer's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant