Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use middleware for grapher redirects #4563

Closed
wants to merge 1 commit into from

Conversation

rakyi
Copy link
Contributor

@rakyi rakyi commented Feb 14, 2025

This has been now reported in Slack multiple times. It confuses authors that they don't see the change after they create a chart redirect. It also means different users can see different charts when clicking on the same link, depending on whether the CDN datacenter that handles their request had the old page cached. I tested this case with Pablo A.

I naively measured how much it takes to fetch a redirect slug in Cloudflare preview deployment, and it's between 2–10 ms for the majority of requests, and the highest outlier I saw was 35 ms.

If there is no redirect, we pay this cost once, if there is one, we pay it twice — first the page gets redirected successfully, then we check the second time as we handle the now correct request.

TODO: It might be better to take the same approach as we did for deleted articles and add temporary redirects to the redirects table with a TTL that is cleaned up in a cron job.

@owidbot
Copy link
Contributor

owidbot commented Feb 14, 2025

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-grapher-redirect-middleware

SVG tester:

Number of differences (default views): 0 ✅
Number of differences (all views): 0 ✅

Edited: 2025-02-14 16:13:35 UTC
Execution time: 1.26 seconds

@rakyi rakyi force-pushed the grapher-redirect-middleware branch from 1324c9f to ce429ab Compare February 14, 2025 16:46
@rakyi rakyi force-pushed the grapher-redirect-middleware branch from ce429ab to 3b4b210 Compare February 14, 2025 17:39
@rakyi rakyi changed the title Add middleware for grapher redirects Use middleware for grapher redirects Feb 14, 2025
@rakyi rakyi changed the base branch from grapher-redirects-timing to master February 14, 2025 17:40
@rakyi rakyi closed this Feb 17, 2025
@rakyi rakyi deleted the grapher-redirect-middleware branch February 17, 2025 15:59
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.

2 participants