Вам нужен cowboy_req:binding
Dispatch = cowboy_router:compile([
{'_', [
{"/:service/:controller/:action/[:id/[...]]", kf_route_handler, []}
]}
]),
handle(Req, State) ->
lager:info("~p",[Req]),
{Controller, _} = cowboy_req:binding(controller, Req, <<"index">>),
{Action, _} = cowboy_req:binding(action, Req, <<"index">>),
{M, _} = cowboy_req:method(Req),
...