Add /qa-302, /qa-303, /qa-307, /qa-308, /qa-401, /qa-404, /qa-429 end… - #5
Merged
Conversation
…points
Adds seven QA-only HTTP status endpoints alongside the existing
/qa-status (200/500), /qa-301, and /qa-403. Implemented as a single
parameterized Netlify Function netlify/functions/qa-code.ts which
inspects the request's public path (req.url in Functions v2 reflects
the original /qa-NNN, not the internal /.netlify/functions/qa-code
path it was rewritten to) and emits the matching status:
/qa-302, /qa-303, /qa-307, /qa-308 -> real 3xx + Location header
(https://weirdanimals.life/)
/qa-401, /qa-404, /qa-429 -> real 4xx + text/html body
with <title> and <h1>
Parameterized over 7 separate files because the only thing that varies
per code is the status number and (for 3xx) the Location header. The
existing per-code files keep their dedicated handlers (qa-status has a
QA_FORCE_500 env toggle that doesn't fit a generic dispatcher).
Defensive: unknown paths return 404 + plain text so misconfiguration
fails loud rather than silently emitting a default status.
- netlify/functions/qa-code.ts: new parameterized function.
- netlify.toml: add 7 new [[redirects]] blocks (one per code), all
targeting /.netlify/functions/qa-code with status = 200 (rewrite
TYPE, preserves upstream status + headers). Placed between the
existing /qa-403 block and the SPA /* catch-all so they are not
swallowed. The existing /qa-status, /qa-301, /qa-403 functions and
redirects are untouched.
No app routes, pages, or dependencies changed.
Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Deploy Preview for weirdanimals ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
…points
Adds seven QA-only HTTP status endpoints alongside the existing /qa-status (200/500), /qa-301, and /qa-403. Implemented as a single parameterized Netlify Function netlify/functions/qa-code.ts which inspects the request's public path (req.url in Functions v2 reflects the original /qa-NNN, not the internal /.netlify/functions/qa-code path it was rewritten to) and emits the matching status:
/qa-302, /qa-303, /qa-307, /qa-308 -> real 3xx + Location header
(https://weirdanimals.life/)
/qa-401, /qa-404, /qa-429 -> real 4xx + text/html body
with <title> and
Parameterized over 7 separate files because the only thing that varies per code is the status number and (for 3xx) the Location header. The existing per-code files keep their dedicated handlers (qa-status has a QA_FORCE_500 env toggle that doesn't fit a generic dispatcher).
Defensive: unknown paths return 404 + plain text so misconfiguration fails loud rather than silently emitting a default status.
No app routes, pages, or dependencies changed.