Skip to content

feat: add tutorial redirects and noindex headers in vercel.json#47

Merged
alfetopito merged 3 commits into
mainfrom
feat/add-redirects
Jan 14, 2026
Merged

feat: add tutorial redirects and noindex headers in vercel.json#47
alfetopito merged 3 commits into
mainfrom
feat/add-redirects

Conversation

@fairlighteth
Copy link
Copy Markdown
Contributor

@fairlighteth fairlighteth commented Dec 19, 2025

Description

Update learn.cow.fi Vercel routing to redirect legacy tutorial slugs to current Learn routes (root or closest equivalent) to eliminate 404s.

Note: beta.learn.cow.fi is already redirected at the Vercel domain level (308), so no host-based rule is included here.

Changes

  • Keep /_app/immutable/workers/* headers: COOP same-origin, COEP require-corp, CORP cross-origin
  • Add X-Robots-Tag: noindex, nofollow, noarchive for /(src(/.)?|tutorial/lib(/.)?|tutorial/types.ts|tutorial/web3-provider.ts|package.json|tsconfig.json|vite.config.ts|.gitignore)
  • 301 redirect the 11 legacy tutorial paths to current Learn routes
Old URL Current Status Expected After Deploy New destination URL
https://learn.cow.fi/tutorial/getting-started-order 404 301 https://learn.cow.fi/tutorial/getting-started
https://learn.cow.fi/tutorial/create-pre-signed-order 404 301 https://learn.cow.fi/tutorial/getting-started
https://learn.cow.fi/tutorial/create-order-app-data 404 301 https://learn.cow.fi/tutorial/getting-started
https://learn.cow.fi/tutorial/create-eth-flow 404 301 https://learn.cow.fi/tutorial/getting-started
https://learn.cow.fi/tutorial/simple-app-data 404 301 https://learn.cow.fi/tutorial/getting-started
https://learn.cow.fi/tutorial/cancel-eth-flow 404 301 https://learn.cow.fi/tutorial/cancel-on-chain-order
https://learn.cow.fi/tutorial/approve-sell-token-order 404 301 https://learn.cow.fi/tutorial/approve-cow-protocol
https://learn.cow.fi/tutorial/orderbook-upload-app-data 404 301 https://learn.cow.fi/tutorial/getting-started
https://learn.cow.fi/tutorial/view-app-data 404 301 https://learn.cow.fi/tutorial/getting-started
https://learn.cow.fi/tutorial/sign-order 404 301 https://learn.cow.fi/tutorial/submit-order
https://learn.cow.fi/tutorial/cancel-pre-signed-order 404 301 https://learn.cow.fi/tutorial/getting-started

Summary by CodeRabbit

  • Chores
    • Added permanent redirects that consolidate various tutorial paths to updated internal tutorial pages.
    • Added per-path headers to prevent search engines from indexing or archiving internal source and configuration content.
    • Updated deployment routing for worker assets to use a revised source pattern for improved asset handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 19, 2025

Deployment failed with the following error:

Header at index 1 has invalid `source` pattern "/(src(/.*)?|tutorial/lib(/.*)?|tutorial/types\.ts|tutorial/web3-provider\.ts|package\.json|tsconfig\.json|vite\.config\.ts|\.gitignore)".

Learn More: https://vercel.link/invalid-route-source-pattern

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 19, 2025

📝 Walkthrough

Walkthrough

Vercel configuration adjusted: updated worker source pattern, added multiple X-Robots-Tag header rules for several project files/paths, and introduced permanent redirects mapping various /tutorial/... routes to other internal /tutorial/... destinations.

Changes

Cohort / File(s) Summary
Vercel configuration
vercel.json
Updated worker source pattern to /_app/immutable/workers/:path*; added multiple headers entries setting X-Robots-Tag: noindex, nofollow, noarchive for /_app/immutable/workers/:path*, /src and /src/:path*, /tutorial/lib and /tutorial/lib/:path*, /tutorial/types.ts, /tutorial/web3-provider.ts, /package.json, /tsconfig.json, /vite.config.ts, /.gitignore; added redirects array with several permanent redirects from various /tutorial/... sources to other internal /tutorial/... destinations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nudged the JSON, neat and spry,

Robots whispered, "Don't index, pass by."
Tutorials rerouted down a tidier track,
Paths now point where the docs lead back.
A little rabbit hops — changes intact. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding tutorial redirects and noindex headers to vercel.json, matching the core modifications in the changeset.
Description check ✅ Passed The description is comprehensive with clear sections for Description and Changes. It includes a detailed table of redirects, explains the reasoning, and uses checkmarks to list the implemented changes per the template structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 19, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@fairlighteth fairlighteth requested a review from a team December 19, 2025 15:10
@fairlighteth fairlighteth self-assigned this Dec 19, 2025
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 19, 2025

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

Project Deployment Review Updated (UTC)
learn Ready Ready Preview Jan 13, 2026 5:45pm

@fairlighteth
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
vercel.json (2)

21-110: Consider consolidating redundant header rules.

The header rules include both base paths and wildcard patterns that may be redundant:

  • Lines 22-28 (/src) and lines 31-37 (/src/:path*)
  • Lines 40-46 (/tutorial/lib) and lines 49-55 (/tutorial/lib/:path*)

Vercel's :path* wildcard typically matches the base path as well, making the separate base path rules potentially unnecessary.

🔎 Potential consolidation

If :path* matches the base directory, you could reduce duplication:

-		{
-			"source": "/src",
-			"headers": [
-				{
-					"key": "X-Robots-Tag",
-					"value": "noindex, nofollow, noarchive"
-				}
-			]
-		},
 		{
 			"source": "/src/:path*",
 			"headers": [
 				{
 					"key": "X-Robots-Tag",
 					"value": "noindex, nofollow, noarchive"
 				}
 			]
 		},
-		{
-			"source": "/tutorial/lib",
-			"headers": [
-				{
-					"key": "X-Robots-Tag",
-					"value": "noindex, nofollow, noarchive"
-				}
-			]
-		},
 		{
 			"source": "/tutorial/lib/:path*",
 			"headers": [
 				{
 					"key": "X-Robots-Tag",
 					"value": "noindex, nofollow, noarchive"
 				}
 			]
 		},

112-168: Legacy tutorial redirects point to a generic landing page instead of specific tutorials.

The CoW Protocol tutorials are hosted in a live-coding environment at learn.cow.fi, yet the 11 legacy /tutorial/* paths all redirect to the same generic URL (https://docs.cow.fi/cow-protocol/tutorials/building). While the building page directs users to learn.cow.fi, it serves only as a gateway page without anchors or subsections for individual tutorials.

Consider redirecting each legacy path to its corresponding specific tutorial at learn.cow.fi (e.g., /tutorial/create-eth-flowlearn.cow.fi/tutorial/create-eth-flow) to preserve semantic content mapping and provide users with more targeted landing pages.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 921b732 and ad90907.

📒 Files selected for processing (1)
  • vercel.json (2 hunks)
🔇 Additional comments (2)
vercel.json (2)

5-5: The path pattern syntax change is correct.

The :path* syntax is Vercel's standard for wildcard path matching and will match nested paths like /blog/:slug* to capture /blog/a/b/c/d/hello-world. The change from regex _app/immutable/workers/(.*) to /_app/immutable/workers/:path* modernizes the syntax and includes the missing leading slash, making the pattern functionally equivalent but expressed in Vercel's preferred syntax.


21-110: Remove X-Robots-Tag headers targeting non-deployed source files and configuration.

These headers target source code and configuration files that are never served by Vercel. With SvelteKit's build process, only prerendered content and static assets are deployed; source directories (/src), TypeScript source files (/tutorial/lib, /tutorial/types.ts, etc.), and configuration files (/package.json, /tsconfig.json, /vite.config.ts, /.gitignore) are excluded from deployment and inaccessible via HTTP. These header rules provide no security benefit and should be removed.

Likely an incorrect or invalid review comment.

Comment thread vercel.json
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad90907 and 1f8597c.

📒 Files selected for processing (1)
  • vercel.json
🔇 Additional comments (2)
vercel.json (2)

4-20: LGTM!

The worker headers configuration correctly preserves COOP/COEP/CORP headers with the updated Vercel path matching syntax /:path*.


21-110: LGTM!

The X-Robots-Tag headers are correctly configured to prevent search engine indexing of source files and configuration paths.

Comment thread vercel.json
Comment on lines +112 to 167
"redirects": [
{
"source": "/tutorial/getting-started-order",
"destination": "/tutorial/getting-started",
"permanent": true
},
{
"source": "/tutorial/create-pre-signed-order",
"destination": "/tutorial/getting-started",
"permanent": true
},
{
"source": "/tutorial/create-order-app-data",
"destination": "/tutorial/getting-started",
"permanent": true
},
{
"source": "/tutorial/create-eth-flow",
"destination": "/tutorial/getting-started",
"permanent": true
},
{
"source": "/tutorial/simple-app-data",
"destination": "/tutorial/getting-started",
"permanent": true
},
{
"source": "/tutorial/cancel-eth-flow",
"destination": "/tutorial/cancel-on-chain-order",
"permanent": true
},
{
"source": "/tutorial/approve-sell-token-order",
"destination": "/tutorial/approve-cow-protocol",
"permanent": true
},
{
"source": "/tutorial/orderbook-upload-app-data",
"destination": "/tutorial/getting-started",
"permanent": true
},
{
"source": "/tutorial/view-app-data",
"destination": "/tutorial/getting-started",
"permanent": true
},
{
"source": "/tutorial/sign-order",
"destination": "/tutorial/submit-order",
"permanent": true
},
{
"source": "/tutorial/cancel-pre-signed-order",
"destination": "/tutorial/getting-started",
"permanent": true
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Redirect destinations don't match PR description.

The PR description states that these 11 tutorial paths should redirect to https://docs.cow.fi/cow-protocol/tutorials/building, but the implementation redirects to internal /tutorial/* paths (e.g., /tutorial/getting-started, /tutorial/submit-order).

Please clarify the intended behavior:

  • If redirects should go to the external docs site, update the destinations to use the full URL.
  • If internal redirects are correct, update the PR description to reflect the actual behavior.

@alfetopito alfetopito merged commit 08ab56e into main Jan 14, 2026
5 checks passed
@alfetopito alfetopito deleted the feat/add-redirects branch January 14, 2026 14:47
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants