Request & Routing Behavior
Boltic Gateway offers flexible and intuitive routing capabilities, designed to handle a wide variety of API traffic scenarios—from simple static routes to complex dynamic rewrites using path parameters and regular expressions.
Request Identification
- A unique Request ID is generated for every incoming request and propagated via the
CF-Ray
response header. - This ID helps trace, debug, and monitor individual requests across systems in distributed environments.
HTTP Method Handling
- The HTTP method (
GET
,POST
,PUT
, etc.) from the incoming request is preserved and used during downstream invocation. - You can configure routes to respond to specific methods or use
ANY
to match all supported HTTP methods (GET, POST, PUT, DELETE, PATCH, OPTIONS).
Use ANY
when your integration needs to handle multiple methods on the same endpoint, like in generic proxying or dynamic workflows.
Base Route Defaults
- A default route (
/
) is automatically created when a gateway is provisioned. - This route can be updated or overridden with more specific paths as needed but it cannot be deleted.
Route Matching
Boltic Gateway uses prefix matching to determine the most specific route that matches the incoming request path.
- If multiple routes match, the longest prefix is chosen.
- If multiple routes have the same longest prefix, the first route encountered is used. For example:
- Routes:
/users
/users/:userId
/users/:userId/orders
- Priority:
/users/:userId/orders
>/users/:userId
>/users
- Routes:
- This ensures that the most specific route is chosen for each request.
Path Parameters
Boltic Gateway supports both named path parameters and regex-based matching for advanced routing use cases.
Named Path Parameters
- Defined using
:param
or{param}
syntax. - Automatically extracted from the incoming path and injected into the downstream request.
Example:
-
Route Config:
/users/:userId/orders/{orderId}
-
Incoming Request:
GET /users/123/orders/456
-
Downstream URL:
/users/123/orders/456
Use Case: Useful for forwarding user- or order-specific requests to downstream services without needing to hardcode paths.
Regex-Based Path Matching
- Supports powerful route patterns using regex groups such as
(.*)
, allowing flexible path captures. - Captured values can be reused in downstream URLs using
$1
,$2
, etc. - The regular expressions used by Boltic Gateway are compatible with those used by the Perl programming language (PCRE).
Example:
-
Route Config:
/files/(.*)/details/(.*)
-
Downstream Template:
https://storage.service.com/bucket/$1/info/$2
-
Incoming Request:
GET /files/invoices_2024/details/latest.pdf
-
Resolved Downstream URL:
https://storage.service.com/bucket/invoices_2024/info/latest.pdf
Use Case: Ideal for dynamic file systems, media routing, or URL mapping scenarios.
Combining Named Parameters & Regex
Boltic allows combining both syntaxes for fine-grained routing control.
Example:
-
Route Config:
/org/:orgId/files/(.*)/details/{fileId}
-
Downstream Template:
https://api.service.com/org/:orgId/path/$2/file/{fileId}
-
Incoming Request:
GET /org/789/files/archive_2023/details/98765
-
Resolved Downstream URL:
https://api.service.com/org/789/path/archive_2023/file/98765
Use Case: Perfect for nested resource structures with a mix of fixed and dynamic segments.
Merge Path Parameters
- For Serverless and Proxy URL integration types, Boltic Gateway supports automatic merging of incoming request path segments into the downstream target URL.
- This is particularly useful when the backend expects the full dynamic path to be appended or preserved.
Example:
- Base URL:
https://functions.boltic.dev/
- Configured Route:
/api/:version/endpoint/(.*)
- Incoming Request:
/api/v1/endpoint/data/123
- Final Target URL:
https://functions.boltic.dev/api/v1/endpoint/data/123
Rewrite Rules
- Downstream URLs can be dynamically constructed using a combination of named parameters, and regex matches
- Supports variables like
:param
,{param}
,$1
Use Case Examples:
-
Geo-sharding: Route traffic to different regions:
https://{region}.service.internal/org/:orgId/data/$1
-
Multi-tenancy: Use tenant-specific domains or paths
https://:tenantId.api.boltic.dev/resources/{resourceId}
With its versatile routing engine, Boltic Gateway enables you to declaratively define, transform, and secure your APIs—making it ideal for both simple use cases and large-scale API infrastructures.