Paths containing tilde (~) break the purger

Created on 28 February 2024, 11 months ago

Problem/Motivation

Cloudfront does not currently support invalidating paths containing tilde character (~). Attempting to do it will throw an error: "Your request contains one or more invalid invalidation paths". This will fill up the logs with errors and fill the purge queue unnecessarily.

Steps to reproduce

1. Have this module installed and configured along with purge_queuer_url
2. Create a page with URL /a~b
3. Visit it incognito
4. Edit the page title
5. Notice the page is now in the purge queue
6. Run cron
7. Notice the error in dblog and the item being stuck in queue

Proposed resolution

The only workaround that I could find is to replace tilde and everything after with a "*" during invalidation (e.g. /my-page?q=lorem~ipsum becomes /my-page?q=lorem*). While this could result in invalidating more cached pages than necessary, I believe it is better than to have the items stuck in queue.

πŸ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡·πŸ‡΄Romania stefan.butura

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024