chore: update gateway URL configuration for staging environment
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 3m25s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 3m25s
- Changed GW_URL and GwUrl in frontoffice-deployment.yaml and Dockerfile to use the internal service URL http://cms-svc:8080 for the staging environment. - Enhanced ConfigureServices to handle HTTP/1.1 for gRPC when using the internal service URL, ensuring compatibility with Kestrel's requirements.
This commit is contained in:
@@ -103,16 +103,28 @@ public static class ConfigureServices
|
||||
var baseUrl = ResolveGatewayUrl(configuration)
|
||||
?? throw new InvalidOperationException("Gateway URL is missing. Set GW_URL or GwUrl.");
|
||||
|
||||
// Register optimized HttpClient for gRPC
|
||||
var isHttp = baseUrl.StartsWith("http://", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
// When the base URL is plain HTTP (e.g. in-cluster http://cms-svc:8080), we must force HTTP/1.1
|
||||
// so that GrpcChannel does not upgrade to h2c and trigger HTTP_1_1_REQUIRED from Kestrel.
|
||||
// For HTTPS the default negotiation is fine.
|
||||
services.AddScoped(sp =>
|
||||
{
|
||||
var handler = new HttpClientHandler
|
||||
{
|
||||
MaxConnectionsPerServer = 10,
|
||||
AutomaticDecompression = System.Net.DecompressionMethods.GZip | System.Net.DecompressionMethods.Deflate
|
||||
};
|
||||
HttpMessageHandler inner = isHttp
|
||||
? new SocketsHttpHandler
|
||||
{
|
||||
MaxConnectionsPerServer = 10,
|
||||
AutomaticDecompression = System.Net.DecompressionMethods.GZip | System.Net.DecompressionMethods.Deflate,
|
||||
DefaultRequestVersion = System.Net.HttpVersion.Version11,
|
||||
DefaultVersionPolicy = System.Net.Http.HttpVersionPolicy.RequestVersionExact
|
||||
}
|
||||
: new HttpClientHandler
|
||||
{
|
||||
MaxConnectionsPerServer = 10,
|
||||
AutomaticDecompression = System.Net.DecompressionMethods.GZip | System.Net.DecompressionMethods.Deflate
|
||||
};
|
||||
|
||||
return new HttpClient(new GrpcWebHandler(GrpcWebMode.GrpcWeb, handler))
|
||||
return new HttpClient(new GrpcWebHandler(GrpcWebMode.GrpcWeb, inner))
|
||||
{
|
||||
Timeout = TimeSpan.FromMinutes(10),
|
||||
BaseAddress = new Uri(baseUrl)
|
||||
|
||||
Reference in New Issue
Block a user