Skip to content

fix(blueprints): sanitize pagination params to eliminate 501 errors#4794

Draft
vfanucci wants to merge 2 commits into
mainfrom
seo/blueprints-pagination-501-fix
Draft

fix(blueprints): sanitize pagination params to eliminate 501 errors#4794
vfanucci wants to merge 2 commits into
mainfrom
seo/blueprints-pagination-501-fix

Conversation

@vfanucci
Copy link
Copy Markdown
Contributor

Summary

Root-cause fix for the recurring /blueprints?… 501 errors that have been masked since April via robots.txt Disallow rules.

The page passed page and size query 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 /blueprints rather than a degraded page.

Two protections introduced:

  1. Validate and clamp pagination params

    • 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. Graceful degradation on API failure

    • Both API calls (tags + blueprint list) are now wrapped in try/catch
    • If the upstream API is unreachable, the page renders the search UI with an empty result set instead of crashing

Also removes the temporary robots.txt workaround:

- # Block the /blueprints pagination bug (critical - 501 errors)
- Disallow: /blueprints?*clid=*
- Disallow: /blueprints?*size=*

The /blueprints listing 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

  • Local build, then verify the following URLs all return 200 with a rendered page:
    • /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)
  • Verify search and pagination still work normally
  • Confirm /robots.txt no longer contains the two /blueprints?* Disallow rules

🤖 Generated with Claude Code

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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

☁️ Cloudflare Worker Preview Deployed!

🔗 https://ks-seo-blueprints-pagination-501-docs.kestra-io.workers.dev
🔗 https://c91a9db3-docs.kestra-io.workers.dev

## 🔦 Lighthouse Benchmark

Tested: https://ks-seo-blueprints-pagination-501-docs.kestra-io.workers.dev on 2026-05-13 14:33 UTC
No baseline available — scores will appear after the first merge to main

Scores (0–100, higher is better)

Page Performance Accessibility Best Practices SEO
Home 71 82 59 92
Pricing 96 91 59 100
Enterprise 96 82 59 100
Cloud 89 86 59 100
About Us 99 91 59 100
Docs Landing 81 88 59 92
Contribute to Kestra (simple docs) 91 87 59 92
Flow (full featured docs) 76 90 59 92
Blog Index 63 90 59 100
Blog Post (sample) 88 87 59 100
VS Page (sample) 95 91 59 100
Plugins Landing 86 80 59 92
Plugin Page (sample) 95 87 59 100
Plugin Debug Page (sample) 94 87 59 100
Plugin Debug Return Page (sample) 95 87 59 100
Blueprints Landing 91 80 56 92
Blueprint Audit Logs CSV Export 0 86 0 100

Core Web Vitals (lower is better)

Page LCP FCP TBT CLS Speed Index
Home 1.07 s 0.70 s 535 ms 0.002 2.12 s
Pricing 1.10 s 0.53 s 127 ms 0.000 0.81 s
Enterprise 0.98 s 0.53 s 141 ms 0.003 0.81 s
Cloud 2.10 s 0.57 s 93 ms 0.000 0.85 s
About Us 0.80 s 0.58 s 70 ms 0.000 0.96 s
Docs Landing 1.35 s 0.57 s 341 ms 0.000 1.05 s
Contribute to Kestra (simple docs) 1.31 s 0.57 s 195 ms 0.000 0.84 s
Flow (full featured docs) 2.04 s 0.59 s 308 ms 0.002 1.26 s
Blog Index 7.95 s 0.57 s 127 ms 0.000 18.58 s
Blog Post (sample) 2.24 s 0.54 s 95 ms 0.000 0.80 s
VS Page (sample) 1.00 s 0.60 s 148 ms 0.064 0.74 s
Plugins Landing 1.01 s 0.50 s 227 ms 0.000 2.33 s
Plugin Page (sample) 0.94 s 0.56 s 96 ms 0.000 1.84 s
Plugin Debug Page (sample) 0.90 s 0.53 s 140 ms 0.001 1.73 s
Plugin Debug Return Page (sample) 0.97 s 0.50 s 113 ms 0.025 1.67 s
Blueprints Landing 1.51 s 0.75 s 66 ms 0.000 1.83 s
Blueprint Audit Logs CSV Export 0.00 s 0.00 s 0 ms 0.000 0.00 s
Legend

🟢 improved  ·  🔻 regressed  ·  (blank) no significant change
Score threshold: ±10 pts  ·  Metric threshold: ±30% of baseline

@vfanucci vfanucci marked this pull request as draft May 13, 2026 16:07
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