aspnet / BasicMiddleware

[Archived] Basic middleware components for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
169 stars 84 forks source link

URL rewrite should preserve the original requested url #151

Closed mikaelm12 closed 7 years ago

mikaelm12 commented 8 years ago

From the URL rewrite reference

The URL Rewrite Module preserves the original requested URL path in the following server variables:

  • HTTP_X_ORIGINAL_URL – this server variable contains the original URL in decoded format;
  • UNENCODED_URL – this server variable contains the original URL exactly as it was requested by a Web client, with all original encoding preserved.
davidfowl commented 8 years ago

Where will you store it? IIS stores them in server variables (we don't have those). Would this be on a feature interface that the middleware exposes?

/cc @Tratcher

Tratcher commented 8 years ago

Doc link?

We already have the original url (RawTarget) here: https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNetCore.Http.Features/IHttpRequestFeature.cs#L60

They only need to be exposed as server variables if another rule in Rewrite tries to access them.

mikaelm12 commented 8 years ago

@Tratcher https://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference#Preserving_Original_URL

What would be the best way to make this more consistent with the IIS HTTP_X_ORIGINAL_URL and UNENCODED_URL variables?

davidfowl commented 8 years ago

Are there any other variables that URL rewrite stores?

muratg commented 8 years ago

Backlogging for now. If we find a use case for the original request URL, we can bring this back later.