Block crawler access to dynamic explorer routes and optimize caching#796
Merged
Conversation
Search/AI crawlers were walking the /transactions, /address and /block pages as an effectively infinite spider trap (each page cross-links to the others), running uncached server functions on every hit. This generated large compute->CDN egress around the clock even with zero human users (production logs showed 100% Applebot traffic on these routes). - robots.ts: disallow /transactions, /address/ and /block/ for all bots and Googlebot (removed from allow lists). Compliant crawlers stay out. - middleware.ts (new): edge-level enforcement for bots that ignore robots.txt. Matches the three route prefixes (catching both the page GET and the Server Action POST) and short-circuits known crawler UAs with a tiny 403 before the heavy function runs. Real users pass through; all responses on these routes carry X-Robots-Tag: noindex, nofollow. - next.config.ts: edge-cache the explorer page shells (s-maxage=300, SWR) so repeat human GETs are CDN hits, not fresh compute. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EHCQFhXU1zen3gmq9ZMbHJ
Protect dynamic explorer routes from crawler traffic
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.
No description provided.