Announcements
Announcements copied to clipboard
Breaking change in IIS UrlRewrite support with query strings
Changes to appendQueryString in IIS UrlRewrite middleware
We are fixing a bug in the IIS UrlRewrite middleware which will append query strings by default instead of removing them. This is to stay consistent with what the IIS UrlRewrite Module's behavior.
Version introduced
ASP.NET Core 5.0-preview7
Old behavior
When having a rewrite rule like the following:
<rule name="MyRule" stopProcessing="true">
<match url="^foo" />
<action type="Redirect" url="/bar" redirectType="Temporary" appendQueryString="true" /> <!-- appendQueryString defaults to true -->
</rule>
This wouldn't actually append the query string. So a URI like /foo?baz=1
wouldn't redirect to /bar?baz=1
and instead /bar
. appendQueryString
defaults to true as well.
New behavior
The new behavior fixes this behavior. Now the URI from the previous example would be /bar?baz=1
.
Reason for change
The previous behavior didn't match the IIS UrlRewrite Module's behavior. Our goal is to have our IIS UrlRewrite middleware match the module as much as possible, so porting between is seamless.
Recommended action
If the behavior of removing the query string is preferred, you can change the action to have appendQueryString="false"
instead.
Category
ASP.NET
Affected APIs
This is the discussion issue for the following announcement: https://github.com/dotnet/aspnetcore/issues/22972
Issue metadata
- Issue type: breaking-change
I am sorry if this is the wrong place to post this question but hopefully it will help clarify for others also. It sounds like the URL Rewrite functionality is included as middleware with .NET 5 and the module is no longer needed. Can you please clarify this? If so, is anything needed to enable it?