We're updating the issue view to help you get more done. 

Destination with smaller number of group match should be selected by the router for routing a request.

Description

In netty-http code, we select the destination route with the maximum number of group match.
e.g. Consider the endpoints:

If the request is for url "/apps/someapp/schedules/DailySchedule/status", it should ideally routed to the second endpoint, however since we select the endpoint with the maximum number of group matches it is routed to the 1st endpoint which has 3 groups as opposed to 2nd endpoint which only has 2 groups.

Relevant:
https://github.com/caskdata/netty-http/blob/develop/src/main/java/co/cask/http/HttpResourceHandler.java#L310

Release Notes

None

Activity

Show:
Poorna Chandra
September 17, 2016, 3:17 AM

We decided to go with weighted scores for matching request URI parts to destination path parts. The matches are weighted in descending order from left to right. For every match, exact matches have higher weight than group matches, and group matches have higher weight than wildcard matches.

PR - https://github.com/caskdata/netty-http/pull/35

Fixed

Assignee

Poorna Chandra

Reporter

Sagar Kapare

Labels

None

Docs Impact

None

UX Impact

None

Priority

Major
Configure