Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Description

add redirects to maintain API routes with old host, allows users to still call old API endpoints but have the URL resolve to sim.ai

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (bun run test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

Additional Information:

Any additional information, configuration or data that might be necessary to reproduce the issue or use the feature.

@vercel
Copy link

vercel bot commented Jul 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 29, 2025 8:57pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Jul 29, 2025 8:57pm

@waleedlatif1 waleedlatif1 merged commit 8d7f3a5 into staging Jul 29, 2025
3 of 4 checks passed
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR implements a domain migration from simstudio.ai to sim.ai while maintaining backwards compatibility for API routes. The changes include three main components:

  1. Domain Redirects: Added redirect configuration in next.config.ts that permanently redirects user-facing pages from the old domain (simstudio.ai) to the new domain (sim.ai), while preserving API routes on the old domain. The regex pattern /((?!api|_next|_vercel|favicon|static|.*\..*).*)/ ensures that API calls, Next.js internal routes, static assets, and files with extensions continue to work on the old domain without redirection.

  2. RB2B Analytics Integration: Added support for RB2B (a B2B visitor identification service) by introducing the NEXT_PUBLIC_RB2B_KEY environment variable in lib/env.ts and conditionally loading the analytics script in app/layout.tsx. This integration allows the application to track business visitors and appears to be part of the domain migration strategy.

  3. Content Security Policy Updates: Modified the CSP in lib/security/csp.ts to allow scripts from https://b2bjsstore.s3.us-west-2.amazonaws.com, which is required for the RB2B analytics script to load properly.

The implementation follows established patterns in the codebase for environment variable management and maintains security through proper CSP configuration. The redirect strategy ensures a smooth user experience during the domain transition while preserving API functionality for existing integrations.

Confidence score: 3/5

• This PR has some implementation concerns that need attention before merging safely
• The redirect regex pattern may not handle all static file types correctly, and there's a discrepancy between the PR description and actual implementation regarding API route handling
• The next.config.ts file needs more careful review of the redirect patterns, while other files appear well-implemented

4 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

async redirects() {
return [
{
source: '/((?!api|_next|_vercel|favicon|static|.*\\..*).*)',
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The regex pattern excludes API routes from redirects, which contradicts the PR description stating 'allows users to still call old API endpoints but have the URL resolve to sim.ai'. Consider if API routes should also redirect or if the description should be clarified.

@waleedlatif1 waleedlatif1 deleted the fix/domain branch July 30, 2025 00:15
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…tudioai#820)

* fix(domain): add redirects to maintain API routes with old host

* fix RB2B

---------

Co-authored-by: waleedlatif <waleedlatif@waleedlatifs-MacBook-Pro.local>
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.

2 participants