Skip to content

Specific HTTP method and route proxyΒ #102

@ce-kkoziel

Description

@ce-kkoziel

Hi @twitchax,

I am trying to solve folowing scenario:

  • I have SomeController
  • This controller contains few GET and POST endpoints
  • I want to proxy only GET endpoints

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions