From 6a822136063d7e160d37b5e10952ac2a7d6415ca Mon Sep 17 00:00:00 2001 From: Rich Siomporas Date: Tue, 26 Aug 2025 21:47:19 -0400 Subject: [PATCH] fix: add keeplive option (CLI and env var) This fix enables Versity Gateway to serve clients that use the AWS C++ SDK - without enabling keepalive in the fiber connection, clients that use the AWS C++ SDK like Run:ai's model streamer [will wig out from all of the closed connections and fail to function](https://github.com/run-ai/runai-model-streamer/issues/55) when connecting to a Versity GW back end. This fix is intentionally side-effect free in that it retains the current default behavior, with the ability to override it via an env var or CLI arg --- cmd/versitygw/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/versitygw/main.go b/cmd/versitygw/main.go index 8741391..4f5c3a0 100644 --- a/cmd/versitygw/main.go +++ b/cmd/versitygw/main.go @@ -54,6 +54,7 @@ var ( healthPath string virtualDomain string debug bool + keepAlive bool pprof string quiet bool readonly bool @@ -223,6 +224,12 @@ func initFlags() []cli.Flag { EnvVars: []string{"VGW_PPROF"}, Destination: &pprof, }, + &cli.BoolFlag{ + Name: "keep-alive", + Usage: "enable keep-alive connections (for finnicky clients)", + EnvVars: []string{"VGW_KEEP_ALIVE"}, + Destination: &keepAlive, + }, &cli.BoolFlag{ Name: "quiet", Usage: "silence stdout request logging output", @@ -604,7 +611,7 @@ func runGateway(ctx context.Context, be backend.Backend) error { AppName: "versitygw", ServerHeader: "VERSITYGW", StreamRequestBody: true, - DisableKeepalive: true, + DisableKeepalive: !keepAlive, Network: fiber.NetworkTCP, DisableStartupMessage: true, })