twitchax / AspNetCore.Proxy

ASP.NET Core Proxies made easy.
MIT License
524 stars 83 forks source link

Get with Query String #71

Closed Lucamuh closed 3 years ago

Lucamuh commented 3 years ago

Query paramets inside the URL (like www.xyz.com/api/v1.0/getarticles?test=5) do not get forwarded.

twitchax commented 3 years ago

This is covered in the README.

[Route("api/google/{**rest}")]
public Task ProxyCatchAll(string rest)
{
    // If you don't need the query string, then you can remove this.
    var queryString = this.Request.QueryString.Value;
    return this.HttpProxyAsync($"https://google.com/{rest}{queryString}");
}