Skip to content

TUL/Exclude /browse, /search and admin paths from SSR (port of upstream #4332) - #1453

Open
milanmajchrak wants to merge 1 commit into
customer/TULfrom
fix/tul-ssr-exclude-browse
Open

TUL/Exclude /browse, /search and admin paths from SSR (port of upstream #4332)#1453
milanmajchrak wants to merge 1 commit into
customer/TULfrom
fix/tul-ssr-exclude-browse

Conversation

@milanmajchrak

Copy link
Copy Markdown
Collaborator
Phases MP MM MB MR JM Total
ETA 0 0 0 0 0 0
Developing 0 0 0 0 0 0
Review 0 0 0 0 0 0
Total - - - - - 0
ETA est. 0
ETA cust. - - - - - 0

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 an amp;value param, 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 excludePathPatterns does not exist, so this PR ports DSpace#4332 natively. universal is 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 -c should 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.

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>
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.

1 participant