Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Support REQUEST_METHOD variable in IIS URL Rewrite file parsing #191

Closed
DamianEdwards opened this issue Dec 13, 2016 · 17 comments
Closed

Support REQUEST_METHOD variable in IIS URL Rewrite file parsing #191

DamianEdwards opened this issue Dec 13, 2016 · 17 comments

Comments

@DamianEdwards
Copy link
Member

We should support the {REQUEST_METHOD} variable when parsing IIS URL Rewrite files. If there's a code equivalent we should support it there too of course. It represents the current request verb (e.g. 'get', 'head', 'post', etc.).

As it stands, the rules in live.asp.net aren't supported.

@DamianEdwards DamianEdwards added this to the 1.1.1 milestone Dec 13, 2016
@DamianEdwards
Copy link
Member Author

@muratg @glennc

@davidfowl
Copy link
Member

Wondering what other missing server variables there are....

@DamianEdwards
Copy link
Member Author

image

@jkotalik
Copy link
Contributor

I blame documentation even though it is like 90% my fault XD

@davidpeden3
Copy link
Contributor

davidpeden3 commented Jan 9, 2017

@Tratcher

fixed in 3c8f2d4

@Eilon
Copy link
Member

Eilon commented Jan 19, 2017

This patch bug is approved. Please use the normal code review process w/ a PR and make sure the fix is in the correct branch, then close the bug and mark it as done.

@Eilon
Copy link
Member

Eilon commented Jan 19, 2017

@muratg please assign this bug.

@mikaelm12
Copy link
Contributor

Fixed in #201

@KallDrexx
Copy link

Did this get removed? After upgrading our Asp.net core project from 1.1 to 2.0 (using the AspnetCore.All package) I now get the following error:

System.FormatException: Unrecognized parameter type: 'REQUEST_METHOD', terminated at string index: '15'
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.ServerVariables.FindServerVariable(String serverVariable, ParserContext context, UriMatchPart uriMatchPart)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.InputParser.ParseParameter(ParserContext context, IList`1 results, UriMatchPart uriMatchPart)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.InputParser.ParseString(ParserContext context, UriMatchPart uriMatchPart)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.InputParser.ParseInputString(String testString, UriMatchPart uriMatchPart)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UriMatchCondition..ctor(InputParser inputParser, String input, String pattern, UriMatchPart uriMatchPart, Boolean ignoreCase, Boolean negate)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UrlRewriteFileParser.ParseCondition(XElement conditionElement, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UrlRewriteFileParser.ParseConditions(XElement conditions, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UrlRewriteFileParser.ParseRuleAttributes(XElement rule, UrlRewriteRuleBuilder builder)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UrlRewriteFileParser.ParseRules(XElement rules, IList`1 result, Boolean global)
   at Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite.UrlRewriteFileParser.Parse(TextReader reader)
   at Microsoft.AspNetCore.Rewrite.IISUrlRewriteOptionsExtensions.AddIISUrlRewrite(RewriteOptions options, TextReader reader)
   at Microsoft.AspNetCore.Rewrite.IISUrlRewriteOptionsExtensions.AddIISUrlRewrite(RewriteOptions options, IFileProvider fileProvider, String filePath)
......

when calling rewriteOptions.AddIISUrlRewrite(env.ContentRootFileProvider, file);

Our rewrite definition file has <add input="{REQUEST_METHOD}" pattern="GET" ignoreCase="true" />

@jkotalik
Copy link
Contributor

@KallDrexx seems you are right. It was added to the 1.0/1.1 branch https://github.com/aspnet/BasicMiddleware/commits/release/1.1 but not the 2.0 branch https://github.com/aspnet/BasicMiddleware/commits/release/2.0?after=8fd34cbb2f62cdf43a892289439b4bdf54ff9699+69. Seems to also not be in dev. @mikaelm12 can you forward port this change?
cc/ @muratg we probably want to patch this for 2.0.x and add this back into dev as it was patched in the 1.1.x chain.

@jkotalik jkotalik reopened this Jan 29, 2018
@DamianEdwards
Copy link
Member Author

Agree this should be patched in 2.0.x

@mikaelm12
Copy link
Contributor

Do we want to sneak this into preview1? @DamianEdwards @muratg

@DamianEdwards
Copy link
Member Author

If the port is straightforward and can be done simply and safely, then it'd be good to get this in preview1

@Eilon
Copy link
Member

Eilon commented Jan 30, 2018

Can we get bugs logged for EACH applicable milestone, and then close this bug?

@mikaelm12
Copy link
Contributor

mikaelm12 commented Jan 30, 2018

Can we get bugs logged for EACH applicable milestone

We don't have a 2.0.7 milestone though yet, right? Because this wouldn't be going into 2.0.6?
Should I just go ahead and add the milestone?

@Eilon
Copy link
Member

Eilon commented Jan 30, 2018

Put in 2.0.6 for now.

@mikaelm12
Copy link
Contributor

This is now being tracked in #292 and #293

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants