Skip to content

Conversation

@bokelley
Copy link
Contributor

Summary

Fixed routing issue where users visiting custom domains via Approximated were incorrectly redirected to the signup page instead of their tenant's home page.

Example: http://sales-agent.accuweather.com now redirects to login instead of signup

Root Cause

The index() function in src/admin/blueprints/core.py always showed the signup landing page for external domains without checking if a tenant was configured for that virtual host.

Solution

Updated routing logic to:

  1. Check if tenant exists for external domain (via virtual_host lookup)
  2. If tenant exists: redirect to /login
  3. If no tenant: show signup page (for new tenant onboarding)

Changes

  • src/admin/blueprints/core.py:64-76 - Updated external domain routing logic
  • tests/unit/test_external_domain_routing.py - Added 5 comprehensive unit tests

Testing

All 5 unit tests pass:

  • ✅ Tenant lookup via Apx-Incoming-Host header
  • ✅ No tenant found for unknown external domains
  • ✅ Index route redirects to login when tenant exists
  • ✅ Index route shows signup when no tenant exists
  • ✅ Subdomain routing with tenant

All pre-commit hooks passed.

🤖 Generated with Claude Code

When users visited custom domains via Approximated (e.g.,
sales-agent.accuweather.com), they were incorrectly redirected to the
signup landing page instead of the tenant's home page.

Root cause: The index() function in core.py always showed landing.html
for external domains without checking if a tenant was configured.

Solution: Check if tenant exists for external domain. If tenant exists,
redirect to login. If no tenant, show signup page.

Changes:
- src/admin/blueprints/core.py:64-76 - Updated routing logic
- tests/unit/test_external_domain_routing.py - Added 5 unit tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley bokelley merged commit b194b83 into main Oct 28, 2025
9 checks passed
EmmaLouise2018 pushed a commit that referenced this pull request Oct 29, 2025
When users visited custom domains via Approximated (e.g.,
sales-agent.accuweather.com), they were incorrectly redirected to the
signup landing page instead of the tenant's home page.

Root cause: The index() function in core.py always showed landing.html
for external domains without checking if a tenant was configured.

Solution: Check if tenant exists for external domain. If tenant exists,
redirect to login. If no tenant, show signup page.

Changes:
- src/admin/blueprints/core.py:64-76 - Updated routing logic
- tests/unit/test_external_domain_routing.py - Added 5 unit tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
…extprotocol#661)

When users visited custom domains via Approximated (e.g.,
sales-agent.accuweather.com), they were incorrectly redirected to the
signup landing page instead of the tenant's home page.

Root cause: The index() function in core.py always showed landing.html
for external domains without checking if a tenant was configured.

Solution: Check if tenant exists for external domain. If tenant exists,
redirect to login. If no tenant, show signup page.

Changes:
- src/admin/blueprints/core.py:64-76 - Updated routing logic
- tests/unit/test_external_domain_routing.py - Added 5 unit tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
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