Closed jkotalik closed 7 years ago
Wait, what requires forwarding? global rules? I don't see that in the description, only that it mutates the full url.
@Tratcher you may be technically correct (i'm not sure, to be honest) and that's what i have implemented. for my use-case, we are using global rules specifically to create a reverse proxy. i went ahead and created a reverse proxy middleware which works for single requests but i'm concerned about concurrency and scale.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory msLoggerFactory, ILogger logger)
{
msLoggerFactory.AddSerilog(logger);
RewriteOptions options = new RewriteOptions().AddIISUrlRewrite(env.ContentRootFileProvider, "RewriteRules.xml");
app.UseRewriter(options);
app.RunReverseProxy();
}
without adding app.RunReverseProxy();
, the server returns a 404
which makes perfect sense. we require the request forwarding.
i'm not really sure what the purpose of a global rule that rewrites the full url would be if it were not being used to implement a reverse proxy but i guess that's technically out of scope for this issue. it seems like a reverse proxy middleware (as i have implemented separately as seen above) would be a great additional sub-project for this repo. definitely interested to hear your thoughts.
i'll try to get the PRs for both issues (this one and https://github.com/aspnet/BasicMiddleware/issues/55) submitted by this weekend, if not sooner. still need to write some unit tests and do a git pull
. you guys appear to have changed some of the code since i originally cloned the repo and fixed one of the bugs that i discovered and also fixed while doing this work.
Currently global rules are treated like normal rules, while rather they should be treated to operate on both the path and path base (AFAIK). Global rules: