Skip to content

fix: remove rewrites and make everything full urls#4133

Merged
Flo4604 merged 2 commits intomainfrom
dont-redirect
Oct 24, 2025
Merged

fix: remove rewrites and make everything full urls#4133
Flo4604 merged 2 commits intomainfrom
dont-redirect

Conversation

@perkinsjr
Copy link
Member

What does this PR do?

A user reported a bug when they used slug of docs which kept redirecting them. We have rewrites in the dashboard that are no longer in use as far as I can tell.

So I removed them and quickly found any /docs and made them a full URL

Fixes # (issue)

If there is not an issue for this, please create one first. This is used to tracking purposes and also helps use understand why this PR exists

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

There isn't much too test, the rewrites were from everything living in the original app, as far as I can tell we handle everything via CNAME / A records

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • [ X] Ran pnpm fmt
  • Checked for warnings, there are none
  • [ X] Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2025

⚠️ No Changeset found

Latest commit: 8e92c31

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Oct 22, 2025

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

Project Deployment Preview Comments Updated (UTC)
engineering Ready Ready Preview Comment Oct 24, 2025 0:38am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
dashboard Ignored Ignored Preview Oct 24, 2025 0:38am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

📝 Walkthrough

Walkthrough

This PR migrates documentation links from internal routes to external URLs. It removes Next.js rewrites that previously proxied /docs and /engineering to mintlify services, and updates dashboard components to reference the external https://www.unkey.com/docs URL directly.

Changes

Cohort / File(s) Summary
Documentation link updates
apps/dashboard/app/(app)/[workspaceSlug]/ratelimits/_components/list/index.tsx, apps/dashboard/app/auth/layout.tsx, apps/dashboard/components/dashboard/command-menu.tsx
Updated href attributes from internal paths (/docs and /docs/ratelimiting/introduction) to external absolute URL (https://www.unkey.com/docs)
Next.js configuration simplification
apps/dashboard/next.config.js
Removed rewrites configuration that proxied /docs, /docs/:match*, /engineering, and /engineering/:match* to mintlify services

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

Bug, Needs Approval

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix: remove rewrites and make everything full urls" is concise, specific, and directly summarizes the main changes in the pull request. It clearly indicates that the PR removes outdated rewrites and converts relative /docs links to full external URLs, which aligns precisely with the file changes shown in the summary. The title uses a conventional commit prefix and avoids vague terminology.
Description Check ✅ Passed The PR description covers most of the required template sections: it explains what the PR does (removing unused rewrites that caused a bug with "docs" slugs), marks the appropriate type of change (bug fix), provides reasoning for testing (rewrites handled via CNAME/A records), and completes the required checklist items. However, the description is missing the issue number reference that the template requires (it still shows "Fixes # (issue)" as placeholder), and the "How should this be tested?" section provides an explanation rather than concrete test steps. Despite these gaps, the description provides sufficient context and completeness to understand the PR's purpose and intent.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dont-redirect

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
Contributor

github-actions bot commented Oct 22, 2025

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dashboard/app/auth/layout.tsx (1)

97-104: Add rel="noopener noreferrer" for security.

The external documentation link uses target="_blank" but is missing the rel="noopener noreferrer" attribute, which prevents potential tabnabbing attacks. Other external links in this file (lines 112-118 and 121-127) correctly include this attribute.

Apply this diff to add the security attribute:

 <Link
   className="flex items-center h-8 gap-2 px-4 text-sm text-white duration-500 border rounded-lg bg-white/5 hover:bg-white hover:text-black border-white/10"
   href="https://www.unkey.com/docs"
   target="_blank"
+  rel="noopener noreferrer"
 >
   <FileText className="w-4 h-4" strokeWidth={1} />
   Documentation
 </Link>
🧹 Nitpick comments (1)
apps/dashboard/components/dashboard/command-menu.tsx (1)

71-89: Consider using window.open() for external URLs.

The GenericLinkCommand uses router.push() for navigation, which is primarily intended for client-side navigation within the Next.js app. For external URLs like the documentation link, window.open() would be more semantically appropriate.

Apply this diff to handle external URLs explicitly:

 const GenericLinkCommand: React.FC<{
   href: string;
   label: string;
   icon: LucideIcon;
   close: () => void;
 }> = (props) => {
   const router = useRouter();
   return (
     <CommandItem
       onSelect={() => {
-        router.push(props.href);
+        if (props.href.startsWith('http://') || props.href.startsWith('https://')) {
+          window.open(props.href, '_blank', 'noopener,noreferrer');
+        } else {
+          router.push(props.href);
+        }
         props.close();
       }}
     >
       <props.icon className="w-4 h-4 mr-2" />
       <span>{props.label}</span>
     </CommandItem>
   );
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c764837 and 46659eb.

📒 Files selected for processing (4)
  • apps/dashboard/app/(app)/[workspaceSlug]/ratelimits/_components/list/index.tsx (1 hunks)
  • apps/dashboard/app/auth/layout.tsx (1 hunks)
  • apps/dashboard/components/dashboard/command-menu.tsx (1 hunks)
  • apps/dashboard/next.config.js (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/dashboard/next.config.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build / Build
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/dashboard/app/(app)/[workspaceSlug]/ratelimits/_components/list/index.tsx (1)

51-60: LGTM! Proper external link implementation.

The documentation link is correctly implemented with an anchor tag, target="_blank", and rel="noopener noreferrer" for security. This is the correct pattern for external links.

@vercel vercel bot temporarily deployed to Preview – engineering October 24, 2025 12:38 Inactive
Copy link
Contributor

@imeyer imeyer left a comment

Choose a reason for hiding this comment

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

LGTM

@graphite-app
Copy link

graphite-app bot commented Oct 24, 2025

Video gif. An elderly man in suspenders smiles as he holds up two thumbs as if saying good luck.  (Added via Giphy)

@Flo4604 Flo4604 added this pull request to the merge queue Oct 24, 2025
@graphite-app
Copy link

graphite-app bot commented Oct 24, 2025

Graphite Automations

"Post a GIF when PR approved" took an action on this PR • (10/24/25)

1 gif was posted to this PR based on Andreas Thomas's automation.

Merged via the queue into main with commit ab14d0f Oct 24, 2025
18 checks passed
@Flo4604 Flo4604 deleted the dont-redirect branch October 24, 2025 13:17
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.

4 participants