Skip to content

feat: AI agent redirect middleware + llms-txt plugin#374

Open
katieschilling wants to merge 1 commit intomainfrom
katieschilling/ai-agent-redirect
Open

feat: AI agent redirect middleware + llms-txt plugin#374
katieschilling wants to merge 1 commit intomainfrom
katieschilling/ai-agent-redirect

Conversation

@katieschilling
Copy link
Copy Markdown
Contributor

@katieschilling katieschilling commented Apr 1, 2026

Summary

  • Add Vercel Edge middleware that detects AI agents (by User-Agent and Accept: text/markdown) and 307-redirects them to .md versions of blog pages
  • Add @signalwire/docusaurus-plugin-llms-txt (same plugin used in tigris-os-docs) to generate llms.txt, llms-full.txt, and per-post .md files at build time
  • Non-agent requests get a Link header pointing to llms.txt for discovery

Reference: tigrisdata/tigris-os-docs#398

Test plan

  • Verify npm run build succeeds and generates build/llms.txt and .md files
  • Test middleware redirects with curl -H "User-Agent: ClaudeBot" -v https://tigrisdata.com/blog/
  • Test normal browser requests pass through with Link header
  • Verify Vercel preview deployment works correctly

🤖 Generated with Claude Code


Note

Medium Risk
Adds edge middleware that alters request/response behavior under /blog, which could affect SEO/caching and any clients expecting existing redirects/headers. Also introduces a new build-time plugin and dependencies that may change generated artifacts and deployment output.

Overview
Adds the @signalwire/docusaurus-plugin-llms-txt plugin to generate llms.txt, llms-full.txt, and per-blog-post .md outputs during the Docusaurus build.

Introduces a Vercel Edge middleware.mjs scoped to /blog/* that detects AI agents (by Accept: text/markdown or known User-Agent patterns) and 307-redirects them to the corresponding .md URL; normal requests pass through but receive a Link header advertising /blog/llms.txt.

Written by Cursor Bugbot for commit f5fc3bb. This will update automatically on new commits. Configure here.

Add Vercel Edge middleware that detects AI agents by User-Agent and
Accept header, redirecting them to .md versions of blog pages. Add
@signalwire/docusaurus-plugin-llms-txt to generate llms.txt and
markdown files at build time for AI consumption.

Assisted-by: Claude Opus 4.6 via Claude Code
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Apr 1, 2026 11:38pm
blog-redirect Ready Ready Preview, Comment Apr 1, 2026 11:38pm

Request Review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread middleware.mjs

export const config = {
matcher: "/blog/:path*",
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Middleware redirects non-post blog paths to likely nonexistent files

Medium Severity

The config.matcher of "/blog/:path*" causes the middleware to redirect AI agents on all blog sub-paths — including tag listing pages (/blog/tags/), specific tag pages (/blog/tags/foo/), and pagination pages (/blog/page/2/) — to .md equivalents like /blog/tags.md or /blog/page/2.md. The PR description states the plugin generates "per-post .md files", so these non-post paths likely have no corresponding .md file, resulting in AI agents receiving a 307 redirect followed by a 404.

Additional Locations (1)
Fix in Cursor Fix in Web

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