Amazon API Gateway now supports routing rules for REST APIs using custom domain names. This new capability enables you to dynamically route incoming requests based on HTTP header values, URL base paths, or a combination of both.
This flexibility enables various use cases, including A/B testing, API versioning, and dynamic backend selection. To use this feature, you define routing rules by assigning priorities, defining conditions (HTTP headers, URL paths, or both), and associating actions. API Gateway then evaluates these rules in priority order with lower numbers taking precedence. When a request meets all conditions in a rule, API Gateway routes it to the configured REST API ID and stage. By implementing routing logic directly within API Gateway, you can eliminate proxy layers and complex URL structures while maintaining granular routing control over your API traffic. This feature is supported on both public and private REST APIs and is compatible with existing API mappings.
Routing rules for custom domain names are available in all AWS Regions, including the AWS GovCloud (US) Regions. To learn more, please refer to the blogpost and the API Gateway documentation.
Source:: Amazon AWS