gRPC Error
This commit is contained in:
@@ -30,6 +30,7 @@ using StackExchange.Redis;
|
||||
using NATS.Client.Core;
|
||||
using NATS.Client.Hosting;
|
||||
using Microsoft.AspNetCore.WebSockets;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using SOR.Auth.Handlers;
|
||||
|
||||
// ── ENABLED_SERVICES ──────────────────────────────────────────────────────────
|
||||
@@ -55,6 +56,23 @@ bool IsEnabled(string name) =>
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Local cleartext gRPC requires a dedicated HTTP/2 listener.
|
||||
// When Auth is enabled in this process and Services:Auth points to a loopback http:// URL,
|
||||
// bind that port explicitly so Gateway can reach the Auth gRPC handler over h2c.
|
||||
if (IsEnabled("auth") &&
|
||||
Uri.TryCreate(builder.Configuration["Services:Auth"], UriKind.Absolute, out var authServiceUri) &&
|
||||
string.Equals(authServiceUri.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase) &&
|
||||
authServiceUri.IsLoopback)
|
||||
{
|
||||
builder.WebHost.ConfigureKestrel(options =>
|
||||
{
|
||||
options.ListenLocalhost(authServiceUri.Port, listenOptions =>
|
||||
{
|
||||
listenOptions.Protocols = HttpProtocols.Http2;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ── Logging ───────────────────────────────────────────────────────────────────
|
||||
// Replace .NET's default logger with Serilog.
|
||||
// Configuration comes from the "Serilog" section of appsettings.json.
|
||||
|
||||
Reference in New Issue
Block a user