Skip to content

Service discovery on MapForwarder disabled when httpClient is assigned #2838

Open
@RamType0

Description

@RamType0

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

  1. Make Aspire project and create Yarp project with reference to api service.
  2. Setup forwarder with following code.
var transformer = app.ServiceProvider.GetRequiredService<ITransformBuilder>().Create(transformBuilderContext
    => transformBuilderContext
    .AddPathRemovePrefix("/Api"));
#if ASSIGN_HTTP_CLIENT
var httpClient = new HttpMessageInvoker(new SocketsHttpHandler
{
    UseProxy = false,
    AllowAutoRedirect = true,
    ConnectTimeout = TimeSpan.FromSeconds(30),
});
app.MapForwarder("/Api/{**apiPath}", "https://api", ForwarderRequestConfig.Empty, transformer, httpClient);

#else
app.MapForwarder("/Api/{**apiPath}", "https://api", ForwarderRequestConfig.Empty, transformer);
#endif
  1. Access to forwarder's path and it works correctly.
  2. define ASSIGN_HTTP_CLIENT.
  3. Access to forwarder's path.
  4. It respond with error codes, and logs say "No such host".

Further technical details

  • Include the version of the packages you are using
  • Yarp.Reverse Proxy 2.3.0
  • The platform (Linux/macOS/Windows)
  • Windows 11 Pro 10.0.26100 Build 26100

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DocumentationImprovements or additions to documentationhelp wantedWe will welcome a contribution

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions