Multi-Domain Support
Configure multi-domain routing in moclojer to handle different hosts and subdomains. Perfect for multi-tenant applications, staging environments, and API versioning by domain.
🎯 How Multi-Domain Routing Works
flowchart LR
A[Incoming Request] --> B{Host Match?}
B -->|Yes| C{Method Match?}
B -->|No host specified| C
C -->|Yes| D{Path Match?}
C -->|No| E[404 Not Found]
D -->|Yes| F[Return Response]
D -->|No| E📝 Basic Configuration
Single Domain Endpoint
🌐 Multi-Tenant Applications
🔧 Environment-Specific Mocks
🌍 Subdomain-Based API Versioning
🔄 Mixed Configuration
🧪 Testing Multi-Domain Locally
Using curl with Host header
Using /etc/hosts for local DNS
Using Docker with custom network
📊 Real-World Use Cases
Use Case
Configuration
Benefit
✅ Best Practices
🔧 Advanced Patterns
Dynamic Host Matching
Conditional Responses Based on Host
🚨 Important Notes
📚 See Also
Last updated
Was this helpful?