Skip to content

fix(shortlink): remove isHosted guard from redirects, not available at build time on ECS#3251

Merged
waleedlatif1 merged 2 commits intostagingfrom
fix/shortlink-redirect
Feb 18, 2026
Merged

fix(shortlink): remove isHosted guard from redirects, not available at build time on ECS#3251
waleedlatif1 merged 2 commits intostagingfrom
fix/shortlink-redirect

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Remove isHosted guard from Beluga short link redirect — isHosted evaluates at build time but NEXT_PUBLIC_APP_URL is a runtime env var on ECS, so the redirect was never registered
  • Remove dead simstudio.ai domain redirects (same issue, and simstudio.ai doesn't have HTTPS configured)
  • Clean up unused isHosted import from next.config.ts

Type of Change

  • Bug fix

Testing

  • Verified /discord redirect works (not gated by isHosted)
  • Verified /r/9Px2V returns 404 on production (confirms redirect was never registered)
  • Tested locally with isHosted set to true — redirect works

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 18, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 18, 2026 9:52pm

Request Review

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 18, 2026

Greptile Summary

This PR fixes a bug where the isHosted flag (derived from NEXT_PUBLIC_APP_URL) was always false at build time on ECS because the env var is only available at runtime. The Beluga short link redirect at /r/:shortCode was never registered as a result.

  • Removed the isHosted guard from the Beluga short link route and converted it from a redirect to a rewrite (transparent proxy), so the tracking URL is not exposed to the end user
  • Removed dead simstudio.aisim.ai domain redirects that suffered the same build-time evaluation issue (and simstudio.ai lacks HTTPS)
  • Cleaned up the unused isHosted import from next.config.ts
  • The /r/:shortCode rewrite is now unconditional across all deployments, including self-hosted instances — this is a minor concern worth considering

Confidence Score: 4/5

  • This PR is safe to merge — it fixes a real bug with a straightforward approach, with a minor note about self-hosted scope.
  • The fix correctly addresses the build-time vs runtime evaluation issue. The change is minimal and well-scoped. Score is 4 instead of 5 because the Beluga rewrite is now unconditionally applied to self-hosted deployments, which may be unintended. This is a low-risk concern but worth acknowledging.
  • apps/sim/next.config.ts — the unconditional rewrite to go.trybeluga.ai may affect self-hosted deployments

Important Files Changed

Filename Overview
apps/sim/next.config.ts Removes broken isHosted guard (build-time vs runtime issue on ECS), removes dead simstudio.ai domain redirects, and converts Beluga short link from redirect to rewrite. The rewrite is now unconditionally active on all deployments including self-hosted.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Incoming request to /r/:shortCode"] --> B{"Before fix: isHosted check at build time"}
    B -->|"isHosted = false (ECS build)"| C["Route never registered ❌"]
    B -->|"isHosted = true (local dev)"| D["302 Redirect to go.trybeluga.ai"]
    
    A --> E{"After fix: No guard, rewrite"}
    E --> F["Transparent rewrite to go.trybeluga.ai ✅"]
    F --> G["User sees /r/:shortCode in browser"]
    G --> H["Server proxies to https://go.trybeluga.ai/:shortCode"]
Loading

Last reviewed commit: 4eda1ec

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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@waleedlatif1 waleedlatif1 merged commit cf28822 into staging Feb 18, 2026
7 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/shortlink-redirect branch February 18, 2026 22:00
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.

1 participant

Comments