dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.38k stars 351 forks source link

Service Discovery: Consider to support paths with suffix (domain/[suffix]) #4710

Open ghostinside opened 1 week ago

ghostinside commented 1 week ago

for now, if i try to use

[domain]/[suffux]/[suffix 1]

service discovery will resolve just domain & try to make an API call to

[domain]/api endpoint

instead of

[domain]/[suffix]/[suffix]/api endpoint

ghostinside commented 1 week ago

or maybe i can add my resolver if possible?

ghostinside commented 1 week ago

seems the magic is here

ResolvingHttpDelegatingHandler method: GetUriWithEndpoint

ghostinside commented 1 week ago

so, i cant create my extension to use my handler

`public static class ServiceDiscoveryHttpClientBuilderExtensions2 { public static IHttpClientBuilder AddServiceDiscovery(this IHttpClientBuilder httpClientBuilder) { var services = httpClientBuilder.Services; services.AddServiceDiscoveryCore(); httpClientBuilder.AddHttpMessageHandler(services => { var timeProvider = services.GetService() ?? TimeProvider.System; var watcherFactory = services.GetRequiredService(); var registry = new HttpServiceEndpointResolver(watcherFactory, services, timeProvider); var options = services.GetRequiredService<IOptions>(); return new ResolvingHttpDelegatingHandler(registry, options); });

    return httpClientBuilder;
}

}`

because the resolver is internal, any work around to replace handler?