twitchax / AspNetCore.Proxy

ASP.NET Core Proxies made easy.
MIT License
505 stars 80 forks source link

Specific HTTP method and route proxy #102

Open ce-kkoziel opened 1 year ago

ce-kkoziel commented 1 year ago

Hi @twitchax,

I am trying to solve folowing scenario:

I was trying with RunProxy middleware UseHttp and HttpContext as an input like this:

`

      application.RunProxy(proxyBuilder =>
      {
        proxyBuilder.UseHttp((context, args) =>
        {
            if (context.Request.Method == "GET" && context.Request.Path.StartsWithSegments("/api/v1/some"))
            {
                return "dest_url";
            }

            return ???
        });
    });

`

But still need return something if condition was not met, null or empty string not working. :/ It seems this middleware usage suggest to proxy all request somewhere?

Is there any other solution rather than this?

Something like this, but only MapGet?

Thanks in advance for your help.