dotnet / dotnet/aspnetcore

Design proposal for issue - IISUrlRewrite "URL" parameter #6002

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

Description

## Summary
This proposal suggests adding support for the {URL} server variable in the ASP.NET Core IIS URL Rewrite implementation, aligning its behavior with IIS URL Rewrite expectations and enabling common rewrite scenarios such as {ToLower:{URL}}.

This change addresses the long-standing issue tracked in #6002.

I’m happy to open a PR implementing this change once there is agreement on the proposed behavior.

## Motivation and goals
- Improve compatibility with IIS URL Rewrite rules that rely on the {URL} server variable.
- Enable common transform scenarios such as {ToLower:{URL}}
- Close issue #6002, which has been marked as help wanted for a long time.

## In scope
- Adding {URL} support to IIS URL Rewrite server variables in ASP.NET Core.
- Supporting usage of {URL} in combination with existing transforms (e.g. ToLower, ToUpper).
- Adding tests that validate the behavior.

## Out of scope
- Any changes to URL Rewrite behavior beyond adding `{URL}` server variable support.
- Support for query string access via `{URL}`.
- Changes to rewrite rule execution, matching logic, or transforms.

## Risks / unknowns
- Clarify whether `{URL}` should reflect the current request path (after previous rewrites) or the original incoming path. This proposal assumes current-path semantics.
- Once {URL} becomes a recognized server variable, rules that previously treated it as a literal string could behave differently, although this is expected to be very rare.

## Examples
### Example 1: Basic usage
Request: `/Products/List`

- `{URL}` → `/Products/List`
- `{ToLower:{URL}}` → `/products/list`

---

### Example 2: URL with query string
Request: `/Products/List?id=10&Sort=Desc`

- `{URL}` → `/Products/List`
- `{QUERY_STRING}` → `id=10&Sort=Desc`
- `{ToLower:{URL}}` → `/products/list`

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.