Closed davidfowl closed 1 week ago
Plan: special case localhost
ServiceDiscoveryDestinationResolver
logic so that if the service resolves to localhost, we do not set the Host propertystring? resolvedHost;
if (_yarpOptions.AlwaysUseConfiguredHostValue)
{
// Always use the configured host value only.
resolvedHost = originalConfig.Host;
}
else if (IsLocalhost(endpoint.EndPoint))
{
// Suppress the host value for localhost
resolvedHost = null;
}
else
{
// Use the configured Host value if set and fall back to the authority from the input URI.
resolvedHost = !string.IsNullOrWhiteSpace(originalConfig.Host) ? originalConfig.Host : originalUri.Authority;
}
The ServiceDiscoveryDestinationResolver sets the host name to the original host in local dev scenarios and this results in a
RemoteCertificateNameMismatch
since the dev cert expects localhost as the domain name (for SNI).This can be worked around by forcing the host name to be localhost in dev scenarios but that's not a great solution:
https://github.com/dotnet/aspire/issues/836#issuecomment-2075656462
cc @ReubenBond