fix: change /shorten-v2 from GET to POST to avoid 414 URI too long - #395
Open
v1vi4n wants to merge 1 commit into
Open
fix: change /shorten-v2 from GET to POST to avoid 414 URI too long#395v1vi4n wants to merge 1 commit into
v1vi4n wants to merge 1 commit into
Conversation
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
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
部署到 Cloudflare 后,
/shorten-v2API 因 URL 过长返回 414 错误。原因:订阅 URL(可能很长)通过 GET query string 传递,超出 Cloudflare 的请求 URI 限制。改动
将
/shorten-v2从 GET 改为 POST,URL 和 shortCode 通过 JSON body 传递:src/app/createApp.jsx):app.get→app.post,从c.req.json()读取参数src/components/formLogic.js):fetch改为 POST + JSON bodytest/worker.test.js): 更新测试用例为 POST 请求