Azure / Azure/azure-functions-host

Add ability to define route order/priority

Open
#3,153 8 comments 20 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

Imagine there are two functions in the same app, both have a GET verb and both have defined routes:

```csharp
[FunctionName("GetRecent")]
public static IActionResult GetRecent(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "items/recent")]HttpRequest req)
{ ... }

[FunctionName("GetItem")]
public static IActionResult Get(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "items/{id}")]HttpRequest req,
string id)
{ ... }
```

As you can see, these routes overlap when `id` equals `recent`. To avoid these issues, ASP.NET MVC would let us define a route order/priority. Azure Functions needs to have this functionality as well.

Workaround: Add constraints to `id` like

```csharp
Route = "items/{id:minlength:10}"
```

or

```csharp
Route = "items/{id:int}"
```

Contributor guide

Open the contributing guide

Research direction

Start with the HTTP trigger route definitions in the issue and inspect how Azure Functions currently resolves overlapping routes. Compare the requested route order or priority with the documented constraint workarounds. Done means overlapping routes have a defined, testable precedence without requiring parameter constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.