You are browsing documentation for an outdated version. See the latest documentation here.
kong.router
Router module.
A set of functions to access the routing properties of the request.
kong.router.get_route()
Returns the current route entity. The request is matched against this route.
Phases
- access, header_filter, response, body_filter, log
Returns
table: Therouteentity.
Usage
local route = kong.router.get_route()local protocols = route.protocols
kong.router.get_service()
Returns the current service entity. The request is targeted to this upstream service.
Phases
- access, header_filter, response, body_filter, log
Returns
table: Theserviceentity.
Usage
if kong.router.get_service() then-- routed by route & service entitieselse-- routed by a route without a serviceend