fix(redirects): anchor the /blog rule to stop the 301 loop on /blogs.md
- Dominant language
- Astro
- Stars
- 155
- Forks
- 177
- Avg merge
- 1d 20m
- Merged PRs (30d)
- 192
Description
Found while probing `.md` URLs for the Markdown for Agents work.
## Problem
`curl -I https://kestra.io/blogs.md` returns `301 Location: /blogss.md`, which returns `301 /blogsss.md`, forever. Any 404 path whose pathname starts with `/blog` hits this.
## Cause
`src/contents/redirects/index.yml` has `regexp: "/blog"` -> `to: "/blogs"`. `resolveRedirect` in `src/utils/redirects.ts` replaces only the matched span (its own doc comment warns catch-all rules must be anchored), so `/blogs.md` becomes `/blogss.md`. The legacy intent is already covered by `blog.yml` (`/blog/(.*)` -> `/blogs/$1`).
## Scope
- Anchor the rule (`^/blog$`) or remove it.
- Add cases to `src/utils/redirects.test.ts`: `/blogs.md` and `/blogss.md` resolve to null, `/blog` still resolves to `/blogs`.
## Done when
- `/blogs.md` returns a single 404 on production.
Contributor guide
Research direction
Open src/contents/redirects/index.yml and src/utils/redirects.test.ts; read the /blog redirect and existing resolveRedirect cases first. Anchor or remove the rule, add cases for /blogs.md and /blogss.md resolving to null while /blog resolves to /blogs, then run the redirect tests and verify /blogs.md returns a single 404.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100