dotnet / dotnet/aspnetcore

The Rewrite middleware changes middleware ordering

Open
#57,987 0 comments 0 reactions 0 assignees View on GitHub
area-middleware
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

When the URL has been modified by the rewrite middleware, it will force to run the routing middleware just after, disregarding the order configured by the developer.

This is an issue because routing might find a suitable endpoint before we had a chance to execute any other middleware (like the static file middleware).

### Expected Behavior

The rewrite middleware doesn't change the middleware order when the URL has been modified.

### Steps To Reproduce

Good repro here from @sgarnovsky https://github.com/sgarnovsky/AspNetCoreIssues/tree/main/BlazorAppUrlRewritingTest

### Exceptions (if any)

_No response_

### .NET Version

8

### Anything else?

Related issue: https://github.com/microsoft/reverse-proxy/issues/2532

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.