Scheduled broken-link and redirect checks that tell you the moment a link breaks — linkbruno.com
This is a hypothetical case study. The company and numbers are invented; the bug is a real class of failure: a redirect that looks correct when you test the path, and destructive once a query string is involved.
The setup
A B2B SaaS company serves a marketing site and an app from the same hostname. nginx handles TLS and a handful of redirects; the app is a Node service behind it. A new SEO ticket asks for trailing slashes on marketing pages, to match the sitemap and to stop Search Console reporting duplicates for /pricing and /pricing/.
An engineer adds a rule adapted from a popular snippet:
rewrite ^([^.]*[^/])$ $1/ permanent;
It is tested with curl -sSI https://example.com/pricing and with a browser. Both get a 301 to /pricing/ and a 200. The change ships on a Tuesday afternoon.
The incident
Tuesday, 16:10. The rule is live. It applies to every path without a dot in the last segment, not just marketing pages. That includes /login, /auth/callback, /billing/return, and /r (the short redirector used in emails and ads).
The rewrite uses $1/. It does not include $is_args$args. nginx therefore issues:
301 https://example.com/login/ # original was /login?token=...
301 https://example.com/auth/callback/ # original was /auth/callback?code=...
301 https://example.com/billing/return/ # original was /billing/return?session_id=...
The paths are "correct". The query strings are gone.
16:10–17:35. Users click "magic link" emails from a mailing that went out at 16:00 and land on the login page, logged out, with no token. OAuth sign-in with Google returns to /auth/callback/ without code and state; the app shows a generic "something went wrong". Customers finishing a card update at the payment provider come back to /billing/return/ without session_id. Ads that used ?utm_... still work as pages, but the campaign data is gone; that part nobody notices yet.
The homepage is fine. /pricing/ is fine. The uptime check hits / and is green. A daily link checker, which requests URLs from the sitemap with no query strings, is also green: every marketing URL 301s once and returns 200.
17:35. Support has a pile of "I can't log in from my email" tickets. An engineer looks at an auth callback URL in a HAR from a teammate, sees the 301 and the missing code, and finds the rewrite.
17:45. The rule is changed to keep the query string, and is limited to a list of marketing paths:
location /pricing {
rewrite ^([^.]*[^/])$ $1/$is_args$args permanent;
}
# ...and the same for a short allowlist of marketing sections
Login, OAuth and billing start working again. About ninety minutes of magic-link emails, sign-ups and payment returns were broken. The morning's ad spend lost its parameters for the rest of the day.
Fixing the immediate damage
They resent the magic-link email to anyone who clicked during the window and didn't log in, issued a short status-page note, and asked the payment provider to resend missed return-URL customers to a support form. Campaign attribution for that afternoon was written off.
A redirect can look perfect in a checker that never sends a query string, and still destroy login and payment links. linkbruno.com is most useful here when you also check the URLs you actually send people to — callbacks, return paths, email links — on a schedule, not only the bare paths in the sitemap.
What actually went wrong
The rule was copied without the query-string part. nginx's $1/ is the path. $is_args$args is the ? and everything after it. The snippet the team found had dropped it, or they had dropped it when they trimmed the example.
The rule was global. A trailing-slash policy for marketing pages was applied to the app's functional URLs, where the slash was never part of the contract.
Tests didn't include a query string. curl -I /pricing cannot fail in the way /auth/callback?code=... failed. The link checker had the same blind spot: it used sitemap URLs, which rarely include one-time tokens.
A 301 was cached. Some browsers that hit the broken callback during the window cached the slash redirect. After the fix, a subset of users still arrived without query strings until the cache expired or they tried a private window. Permanent redirects on URLs that carry tokens are a bad mix.
The fixes
1. Preserve arguments on every redirect, unless a parameter is being stripped on purpose, in a named list.
2. Scope trailing-slash rules to the sections that need them. App routes, API routes, and callback paths should not inherit a marketing SEO rule.
3. Use 308/301 carefully on transactional paths. For callbacks, better not to redirect at all: register the exact URL, slash and all, with the provider.
4. Add tests that would have caught this in CI: a request to /pricing?utm_source=test must 301 to /pricing/?utm_source=test, and /auth/callback?code=test must not redirect. A small suite of curl assertions in the deploy pipeline would have failed the original rule.
5. Include at least a handful of query-string URLs in scheduled link checks, even if the tokens are dummies: the return path, the OAuth callback, a sample campaign URL. The assertion is "the parameter is still there at the end", not "the token is valid".
What I'd take from it
Redirect tests that never send ? are incomplete. SEO rules should not be global. And the links that hurt when they break — login, payments, emailed tokens — are often absent from sitemaps, so a sitemap-only checker will not save you.
Related reading
- How to find redirect chains and redirect loops with a short Python script (and why a 200 at the end can still be a problem)
- ERR_TOO_MANY_REDIRECTS: the 6 configs that cause redirect loops and how to find them
- Case study (hypothetical): after the domain change, every paying customer landed on a 404
- Should your link checker ignore URLs that differ only by UTM and tracking parameters? Let's argue about it
Have you had a trailing-slash or HTTPS redirect eat a query string? Which flow broke first, login, payments, or campaigns?
Top comments (0)