TUL/Exclude /browse, /search and admin paths from SSR (port of upstream #4332) - #1453
Open
milanmajchrak wants to merge 1 commit into
Open
TUL/Exclude /browse, /search and admin paths from SSR (port of upstream #4332)#1453milanmajchrak wants to merge 1 commit into
milanmajchrak wants to merge 1 commit into
Conversation
DSpace#4332) Crawlers were feeding on SSR-rendered /browse pages: DSpace reflects unknown query params into generated links, and non-decoding crawlers turn the escaped separator into ever-growing amp;value params - an infinite URL space. On 7.5 every such URL is a full SSR render (~21 backend calls), which took the site down on Aug 6-9. Ports upstream dspace-7_x PR DSpace#4332 (excludePathPatterns) natively: excluded paths are served as CSR shell with no links to follow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem description
Reported issues
New Relic: PING TUL DSPACE FE/BE alerts Aug 6-9 (504s, read timeouts). Backend at 130 % CPU, 289k upstream timeouts/day, successful responses dropped from 94k to 34k/day.
Not-reported issues
DSpace reflects unknown query params into links it generates on /browse and /search. A crawler that does not decode HTML entities turns the escaped
&into anamp;valueparam, gets a valid 200 page with 21 new links, and loops - an infinite URL space. 52 % of all requests during the incident were these URLs.Reproducible on any 7.5 instance:
curl -s 'https://dspace.tul.cz/browse/author?zzz=1' | grep -c 'zzz=1'(non-zero = param reflected into links).Analysis
Upstream closed this class of traffic in 7.6.5 by excluding /browse, /search and admin paths from SSR (DSpace#4332): excluded paths get the CSR shell, so a non-JS crawler sees no links to follow and each hit costs no backend calls. customer/TUL is on 7.5 where
excludePathPatternsdoes not exist, so this PR ports DSpace#4332 natively.universalis not yaml-configurable in 7.5 - the defaults in the environment files are the effective values.Interim mitigation (nginx 410 on
amp;URLs) is already deployed on the machine and can stay.Verified: exclusion regexes tested against real paths (/browse/author, /search -> CSR; /items/, /handle/, / -> SSR). Not verified: full yarn build on this branch - needs CI.
After deploy:
curl -s https://dspace.tul.cz/browse/author | wc -cshould drop from ~455 kB to ~2 kB.Problems
Trade-off: browse pages leave SSR also for legitimate non-JS crawlers (Googlebot). Same default upstream ships since 7.6.5 and what vsb/mendelu/lindat already run.