Skip to content

fix(seo): noindex non-production sim.ai hosts, redirect indexed 404s - #5988

Merged
waleedlatif1 merged 3 commits into
stagingfrom
worktree-seo-redirects-robots
Jul 27, 2026
Merged

fix(seo): noindex non-production sim.ai hosts, redirect indexed 404s#5988
waleedlatif1 merged 3 commits into
stagingfrom
worktree-seo-redirects-robots

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • dev.sim.ai / staging.sim.ai serve the same build as www.sim.ai and were fully crawlable (Allow: /) — they now return X-Robots-Tag: noindex, nofollow
  • 301 seven marketing paths an external SEO audit found 404ing: /read, /research, /scrape/integrations; /actions, /crawl, /fast, /security/

Notes

Emir's ask was a robots.txt Disallow on dev. noindex is the correct mechanism instead: a disallowed URL can still be indexed when linked externally, and blocking the crawl stops Google from ever seeing the directive that removes pages already in the index. robots.txt is therefore left untouched and stays crawlable — it's already excluded from the proxy matcher.

Host classification is a pure function keyed off SITE_URL, so sim.ai and www.sim.ai are both canonical, self-hosted domains and lookalikes (notsim.ai, sim.ai.evil.com) are unaffected, and the header is applied in track() — the single chokepoint every proxy return path flows through.

Not in scope, both outside this repo:

  • vou.sim.ai, dogutopia.sim.ai, oceanriser.sim.ai etc. return Vercel's platform 404 — stale hostnames on the project with no deployment routed. Needs a Vercel/DNS cleanup.
  • dev.sim.ai apex 301s to https://www.dev.sim.ai:443/ — ALB leaking the port into Location.

The ~112 /models/**/opengraph-image rows in the tracker are already fixed (#5636); prod emits the hash-suffixed URL, which returns 200. The bare path 404s by design and should not be redirected.

Type of Change

  • Bug fix

Testing

  • 54 unit tests pass (urls.test.ts, seo.test.ts, mailer.test.ts), including 12 new cases pinning host classification
  • Asserted all 7 redirects resolve exactly once with no collisions against the existing 30 by executing redirects()
  • Verified against production that all 7 paths currently 404 and that the OG-image rows already serve 200
  • tsc and biome clean

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)

Non-production deployments (dev.sim.ai, staging.sim.ai) serve the same
build as www.sim.ai and were fully crawlable. Send X-Robots-Tag noindex
for those hosts, and 301 seven marketing paths that an external SEO
audit found returning 404.
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 27, 2026 11:22pm

Request Review

@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
SEO and redirect behavior only; host checks are conservative and /security is excluded from redirects.

Overview
Non-canonical sim.ai hosts (e.g. dev.sim.ai, staging.sim.ai) now get X-Robots-Tag: noindex, nofollow on every proxy response via new isNonCanonicalSimHost() and applyIndexingPolicy() in track(), instead of relying on robots.txt Disallow. Canonical sim.ai / www.sim.ai, self-hosted domains, and lookalikes are unchanged; forwarded-host lists use only the first entry.

Indexed marketing 404s get permanent redirects: /read, /research, /scrape/integrations; /actions, /crawl, /fast/. /security is intentionally not redirected (security.txt policy URI).

getEmailDomain() now shares a small stripWwwPrefix helper with host classification; test mocks mirror the new URL utilities.

Reviewed by Cursor Bugbot for commit 4a304f1. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds SEO hardening for non-production sim.ai hosts and permanent redirects for audited marketing 404s.

  • isNonCanonicalSimHost classifies subdomains of the canonical marketing host (after stripping www/port and taking the first forwarded-host entry) so dev/staging get X-Robots-Tag: noindex, nofollow via track() in the proxy.
  • Permanent redirects: /read, /research, /scrape/integrations; /actions, /crawl, /fast/ (/security intentionally omitted because security.txt advertises it as the Policy URI).
  • Tests and the shared urlsMock cover the new export so proxy-loading tests do not hit undefined.

Confidence Score: 5/5

This PR appears safe to merge; prior review concerns around forwarded-host parsing, the /security redirect, and the urls mock are addressed in the current HEAD with no remaining blocking failures identified under follow-up scope.

No blocking failure remains. Host-based noindex is limited to non-canonical *.sim.ai hosts, redirects cover the intended 404 paths without colliding with the security.txt Policy URI, and the testing mock exports the new symbols used by the proxy path.

Important Files Changed

Filename Overview
apps/sim/proxy.ts Applies X-Robots-Tag noindex/nofollow on non-canonical sim.ai hosts inside track() using the first x-forwarded-host entry or Host.
apps/sim/lib/core/utils/urls.ts Adds isNonCanonicalSimHost keyed off SITE_URL/CANONICAL_SITE_HOST with www/port stripping and first comma-joined host entry.
apps/sim/next.config.ts Adds permanent redirects for six audited 404 marketing paths; omits /security to preserve the security.txt Policy URI.
packages/testing/src/mocks/urls.mock.ts Mirrors CANONICAL_SITE_HOST and isNonCanonicalSimHost so global urlsMock stays complete for proxy tests.
apps/sim/lib/core/utils/urls.test.ts Pins canonical vs non-canonical host classification including comma-joined forwarded hosts and lookalikes.

Sequence Diagram

sequenceDiagram
  participant Client
  participant Proxy as apps/sim/proxy
  participant Classify as isNonCanonicalSimHost
  participant Next as Next.js response

  Client->>Proxy: request (Host / x-forwarded-host)
  Proxy->>Proxy: build NextResponse
  Proxy->>Proxy: track(request, response)
  Proxy->>Classify: host (first forwarded entry)
  alt "non-canonical *.sim.ai (e.g. dev.sim.ai)"
    Classify-->>Proxy: true
    Proxy->>Next: set X-Robots-Tag noindex, nofollow
  else www.sim.ai / sim.ai / other domains
    Classify-->>Proxy: false
    Proxy->>Next: no indexing header
  end
  Proxy-->>Client: response
Loading

Reviews (3): Last reviewed commit: "fix(seo): drop the /security redirect, c..." | Re-trigger Greptile

Comment thread apps/sim/proxy.ts
A multi-value x-forwarded-host survives the port split intact, so
endsWith('.sim.ai') matched on the trailing entry and could apply
noindex to the canonical site. Normalize with the same
split(',')[0].trim() the rest of the repo uses for forwarded headers.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/next.config.ts
Comment thread apps/sim/lib/core/utils/urls.ts
security.txt advertises /security as its RFC 9116 Policy URI, so a
permanent redirect to marketing would mislead that link and shadow a
real policy page added later.

urlsMock is installed globally and documents itself as carrying every
real export, but was missing CANONICAL_SITE_HOST and
isNonCanonicalSimHost — any test loading proxy.ts would have called
undefined in track().
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4a304f1. Configure here.

@waleedlatif1
waleedlatif1 merged commit 23bc210 into staging Jul 27, 2026
20 checks passed
@waleedlatif1
waleedlatif1 deleted the worktree-seo-redirects-robots branch July 27, 2026 23:33
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