feat: add tutorial redirects and noindex headers in vercel.json#47
Conversation
|
Deployment failed with the following error: Learn More: https://vercel.link/invalid-route-source-pattern |
📝 WalkthroughWalkthroughVercel configuration adjusted: updated worker source pattern, added multiple X-Robots-Tag header rules for several project files/paths, and introduced permanent redirects mapping various Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ 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. Comment |
|
All contributors have signed the CLA ✍️ ✅ |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
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-flow→learn.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
📒 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.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 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.
| "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 | ||
| } |
There was a problem hiding this comment.
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.
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
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.