URL Configuration#
The URL configuration phase in Peakhour.IO processes rules based on the received request headers. When a rule's condition evaluates to true, the system executes the associated actions and stops further processing.
Example#
The filter matches requests with a URI path that starts with "/api/v1/":
starts_with(http.request.uri.path, "/api/v1/")
The configuration enables caching for API requests:
vconf.set:
cdn_enabled: "true"
cdn_query_mode: "strip"
implicit_cache_ttl: "3600"
This configuration strips query parameters and sets a cache time-to-live of 1 hour.
Available Actions#
- vconf.set: Sets configuration parameters for use in the request processing pipeline.
Fields#
The URL phase provides access to the following fields:
- Request fields: Request information such as Host header and Referer header.
- GeoIP fields: Client location information including AS number and country code.
- User agent fields: Client user agent information, including device type and bot status.
Use Cases#
- Apply different caching rules for specific API versions.
- Implement geolocation-based content delivery.
- Customise bot handling based on user agent information.