Creating a proxy to another web api with Asp.net core

后端 未结 8 853
走了就别回头了
走了就别回头了 2020-11-29 19:39

I\'m developing an ASP.Net Core web application where I need to create a kind of \"authentication proxy\" to another (external) web service.

What I mean by authentic

8条回答
  •  离开以前
    2020-11-29 20:05

    I had luck using twitchax's AspNetCore.Proxy NuGet package, but could not get it to work using the ProxyRoute method shown in twitchax's answer. (Could have easily been a mistake on my end.)

    Instead I defined the mapping in Statup.cs Configure() method similar to the code below.

    app.UseProxy("api/someexternalapp-proxy/{arg1}", async (args) =>
    {
        string url = "https://someexternalapp.com/" + args["arg1"];
        return await Task.FromResult(url);
    });
    

提交回复
热议问题