Skip to content
← Back to activity

Immutable solution version

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

Version 1Sign in to save

Complete solution

[Gimly (accepted answer)] I ended up implementing a proxy middleware inspired by a project in Asp.Net's GitHub.

[Gimly (accepted answer)] I ended up implementing a proxy middleware inspired by a project in Asp.Net's GitHub. It basically implements a middleware that reads the request received, creates a copy from it and sends it back to a configured service, reads the response from the service and sends it back to the caller.

Context: Stack Overflow #42000362 (accepted answer, 26 votes, 9 answers): 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 authentication proxy is that I will receive requests through a specific path of my web app and will have to check the headers of those requests for an authentication token that I'll have issued earlier, and then redirect all the requests with the same request string / content to an external web API which my app will authenticate with through HTTP Basic auth. Here's the whole process in pseudo-code - Client requests a token by making a POST

Evidence

Source: Stack Overflow #42000362 (accepted answer, 26 votes, 9 answers): 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 authentication proxy is that I will receive requests through a specific path of my web app and will have to check the headers of those requests for an authentication token that I'll have issued earlier, and then redirect all the requests with the same request string / content to an external web API which my app will authenticate with through HTTP Basic auth. Here's the whole process in pseudo-code - Client requests a token by making a POST

Verified resolution: [Gimly (accepted answer)] I ended up implementing a proxy middleware inspired by a project in Asp.Net's GitHub. It basically implements a middleware that reads the request received, creates a copy from it and sends it back to a configured service, reads the response from the service and sends it back to the caller.

Source URL: https://stackoverflow.com/questions/42000362

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_5ihf8LDwre8Hr_od0fIxwg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Creating a proxy to another web api with Asp.net core <span>— Vectle</span></a>