Spaces in rewritten URLs

Fremantle

· Cargo · MediaWiki · Apache · system administration ·

The WMAU calendar feed broke after a recent upgrade to Apache. It was returning a 403 Forbidden response, but it wasn't immediately clear why. The logs were showing e.g. "… [rewrite:error] … AH10411: Rewritten query string contains control characters or spaces" where there'd never been an issue before.

The /events.ics URL is a rewrite to a CargoExport URL: RewriteRule ^events.ics$ "/w/index.php?title=Special:CargoExport&tables=events&fields=_pageID,_pageName,start_date=start,end_date=end,location,CONCAT('More information: https://wikimedia.org.au/wiki/Special:Redirect/page/',_pageID)=description&where=DATE(end_date)>=DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH)&format=icalendar&icalendar name=WMAU&icalendar description=Wikimedia Australia coming events&filename=events.ics" [L]

Turns out it's because of fixing CVE-2023-25690, and the fix here was to use + for spaces (and not %20 as I first tried): RewriteRule ^events.ics$ "/w/index.php?title=Special:CargoExport&tables=events&fields=_pageID,_pageName,start_date=start,end_date=end,location,CONCAT('More+information:+https://wikimedia.org.au/wiki/Special:Redirect/page/',_pageID)=description&where=DATE(end_date)>=DATE_SUB(CURRENT_DATE,+INTERVAL+3+MONTH)&format=icalendar&icalendar+name=WMAU&icalendar+description=Wikimedia+Australia+coming+events&filename=events.ics" [L]