routes
Routing Configuration
CloudBase HTTP Access Service offers flexible routing configuration capabilities, allowing you to precisely route requests to various backend resources such as Cloud Run, Cloud Functions, and Static Hosting, enabling unified request distribution management.
Routing Matching Rules
Routing Configuration consists of two core elements: domain and path. These elements are matched in a specific priority order.
Matching Priority
Domain Matching:
- Exact matches (e.g.,
example.com) take precedence over wildcard matches (e.g.,*) - Supports using wildcard
*to match any domain.
- Exact matches (e.g.,
Path Matching:
- Following the longest matching principle, the system prioritizes selecting the rule that best matches the request path.
- Path matching is prefix matching, such as
/barcan match/bar/xxx
Matching Flowchart

Routing Matching Example
The following table displays a set of routing rule configurations.
| Domain | Path | Associated Resource |
|---|---|---|
| * | / | FunctionA |
| * | /bar | FunctionB |
| <Default Domain Name> | /bar | FunctionC |
| foo.com | / | FunctionD |
| foo.com | /bar | FunctionE |
| foo.com | /bar/baz | FunctionF |
Request Matching Result
Based on the above configuration, different requests are routed to different resources:
| Access URL | Matched Resource | Matching Reason |
|---|---|---|
| <Default Domain Name>/xxx | FunctionA | The domain name is matched by the wildcard *, and the path /xxx matches the prefix / |
| <Default Domain Name>/bar | FunctionC | The default domain name is matched exactly, and the path /bar is matched exactly |
| <Default Domain Name>/bar/xxx | FunctionC | The default domain name is matched exactly, and the path /bar/xxx matches the prefix /bar |
| foo.com/xxx | FunctionD | The domain name foo.com is matched exactly, and the path /xxx matches the prefix / |
| foo.com/bar | FunctionE | The domain name foo.com is matched exactly, and the path /bar is matched exactly |
| foo.com/bar/xxx | FunctionE | The domain name foo.com is matched exactly, and the path /bar/xxx matches the prefix /bar |
| foo.com/bar/baz | FunctionF | The domain name foo.com is matched exactly, and the path /bar/baz is matched exactly (longest matching rule) |