Skip to content

Site: redirect links with Markdown junk stuck to the end (/**) instead of a 404 - #21

Merged
dpdev69 merged 1 commit into
mainfrom
claude/project-thread-19gxz5
Oct 21, 2026
Merged

dpdev69 merged 1 commit into
mainfrom
claude/project-thread-19gxz5

Conversation

@dpdev69

@dpdev69 dpdev69 commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Requested by Boss · project thread

Links pasted from chat apps and AI answers often arrive with Markdown or punctuation glued to the end of the URL (/**, /privacy).), and visitors land on the 404 page.

  • functions/_middleware.js: when the page answer is a 404 and the path ends in * _ ) ] . , ; : ! ' " \ > (or their %-encodings), 301 to the path without that tail (/if nothing is left), query kept. Real pages are never redirected (only 404s), and the clean path is served or 404s as usual, so no loops. The CSP nonce step is unchanged./assets/* still skips the Function (_routes.json`).

No site test script in this repo. Checked locally with wrangler pages dev site: /** 301 /, /privacy** and /privacy). 301 /privacy, /privacy 200 with the nonce CSP, /privacy.html 308 (unchanged), /nope 404, /llms.txt** 301 /llms.txt.


Generated by Claude Code

…d of a 404

Links pasted from chat apps and AI answers often carry "**", ")." or similar
after the path. A 404 whose path ends in that junk now 301s to the clean path.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BvkbbPEvpbYWP2r43ZqnW
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying upright with  Cloudflare Pages  Cloudflare Pages

Latest commit: bd6b5ee
Status: ✅  Deploy successful!
Preview URL: https://01efd2c1.upright-2ev.pages.dev
Branch Preview URL: https://claude-project-thread-19gxz5.upright-2ev.pages.dev

View logs

@dpdev69
dpdev69 merged commit bf0f98a into main Oct 21, 2026
4 checks passed
@dpdev69 dpdev69 self-assigned this Oct 21, 2026
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