Skip to content

feat(frontend): Redirect from www. to root domain #10010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Swiftyos
Copy link
Contributor

Summary

  • redirect www subdomains to the root domain in middleware

Testing

  • yarn lint
  • yarn test (fails: Process from config.webServer exited early)

@Swiftyos Swiftyos requested a review from a team as a code owner May 22, 2025 15:04
@Swiftyos Swiftyos requested review from Pwuts and majdyz and removed request for a team May 22, 2025 15:04
@github-project-automation github-project-automation bot moved this to 🆕 Needs initial review in AutoGPT development kanban May 22, 2025
Copy link

netlify bot commented May 22, 2025

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit a393d40
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs-dev/deploys/682f3ce386f05c0008e15e6b

Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect Slicing

The code assumes 'www.' is always 4 characters, but this might not handle edge cases correctly if the hostname format varies. Consider using a more robust approach like replacing the www. prefix or using URL manipulation methods.

url.hostname = host.slice(4);
return NextResponse.redirect(url);
Missing Return Type

The middleware function doesn't explicitly declare its return type, which would improve type safety and code clarity.

export async function middleware(request: NextRequest) {
  const host = request.headers.get("host");

@github-actions github-actions bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end labels May 22, 2025
Copy link

deepsource-io bot commented May 22, 2025

Here's the code health analysis summary for commits 8f1b3eb..a393d40. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗
DeepSource Python LogoPython✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

netlify bot commented May 22, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit a393d40
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/682f3ce301ec350008fa697f

@Pwuts Pwuts changed the title Fix www redirect in frontend middleware feat(frontend): Redirect from www. to root domain May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codex platform/backend AutoGPT Platform - Back end platform/frontend AutoGPT Platform - Front end Review effort 2/5 size/s
Projects
Status: 🆕 Needs initial review
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant