gRPC Error

This commit is contained in:
dingo
2026-02-28 08:40:05 -05:00
parent c6177cd627
commit 0945208e48
14 changed files with 55 additions and 3 deletions
+18
View File
@@ -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.