fix(blueprints): sanitize pagination params to eliminate 501 errors#4794
Draft
vfanucci wants to merge 2 commits into
Draft
fix(blueprints): sanitize pagination params to eliminate 501 errors#4794vfanucci wants to merge 2 commits into
vfanucci wants to merge 2 commits into
Conversation
The /blueprints index page passed `page` and `size` query params raw into the upstream API call. Malformed values (size=99999, page=abc, or unexpected tracking params) caused the API to return 501, which in turn produced a hard crash on /blueprints rather than a degraded page. Two protections introduced: 1. Validate and clamp pagination - page: positive integer, capped at 1000 (default 1) - size: positive integer, capped at 48 (default 24) - Non-numeric or out-of-range values silently fall back to defaults 2. Wrap both API calls (tags + blueprint list) in try/catch The page now renders an empty result set with the search UI intact if the upstream API is unreachable, instead of crashing. Also removes the temporary robots.txt workaround that masked the bug (`Disallow: /blueprints?*clid=*` and `?*size=*`), so the blueprints listing becomes fully crawlable again with garbage params handled defensively at the source. Identified in the May 13, 2026 SEO follow-up audit (§2.1, §11.2). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
☁️ Cloudflare Worker Preview Deployed!🔗 https://ks-seo-blueprints-pagination-501-docs.kestra-io.workers.dev ## 🔦 Lighthouse Benchmark
Scores (0–100, higher is better)
Core Web Vitals (lower is better)
Legend🟢 improved · 🔻 regressed · (blank) no significant change |
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.
Summary
Root-cause fix for the recurring
/blueprints?…501 errors that have been masked since April via robots.txtDisallowrules.The page passed
pageandsizequery string values raw into the upstream API. Malformed values (size=99999,page=abc, or unexpected tracking params injected by ad networks) caused the API to return 501, which in turn produced a hard render failure on/blueprintsrather than a degraded page.Two protections introduced:
Validate and clamp pagination params
page: positive integer, capped at 1000 (default1)size: positive integer, capped at 48 (default24)Graceful degradation on API failure
try/catchAlso removes the temporary robots.txt workaround:
The
/blueprintslisting becomes fully crawlable again with malformed query strings handled defensively at the source.Context
Identified in the May 13, 2026 SEO follow-up audit (§2.1 and §11.2 — the only remaining Critical-tier item alongside the empty CSP value). The robots.txt workaround was in place since April and has been blocking legitimate crawls for ~30 days.
Test plan
/blueprints/blueprints?page=1&size=24(normal)/blueprints?size=99999(clamped to 48)/blueprints?page=abc&size=-5(falls back to defaults)/blueprints?clid=fb_test_id(ignored unknown param)/robots.txtno longer contains the two/blueprints?*Disallow rules🤖 Generated with Claude Code