@@ -80,14 +80,14 @@ type Config struct {
8080 // DecoderInsecureSkipVerify configure the proxy to skip TLS verification for requests to decoder.
8181 DecoderInsecureSkipVerify bool
8282
83- // enableSSRFProtection enables SSRF protection.
84- enableSSRFProtection bool
83+ // EnableSSRFProtection enables SSRF protection.
84+ EnableSSRFProtection bool
8585
86- // inferencePoolNamespace InferencePool object namespace.
87- inferencePoolNamespace string
86+ // InferencePoolNamespace InferencePool object namespace.
87+ InferencePoolNamespace string
8888
89- // inferencePoolNamespace InferencePool object name.
90- inferencePoolName string
89+ // InferencePoolName InferencePool object name.
90+ InferencePoolName string
9191}
9292
9393type protocolRunner func (http.ResponseWriter , * http.Request , string )
@@ -113,7 +113,7 @@ func NewProxy(port string, decodeURL *url.URL, config Config) (*Server, error) {
113113 cache , _ := lru.New [string , http.Handler ](16 ) // nolint:all
114114
115115 // Create SSRF protection validator
116- validator , err := NewAllowlistValidator (config .enableSSRFProtection , config .inferencePoolNamespace , config .inferencePoolName )
116+ validator , err := NewAllowlistValidator (config .EnableSSRFProtection , config .InferencePoolNamespace , config .InferencePoolName )
117117 if err != nil {
118118 return nil , fmt .Errorf ("failed to create SSRF protection validator: %w" , err )
119119 }
@@ -165,7 +165,13 @@ func (s *Server) Start(ctx context.Context) error {
165165 // Configure handlers
166166 mux := s .createRoutes ()
167167
168- server := & http.Server {Handler : mux }
168+ server := & http.Server {
169+ Handler : mux ,
170+ // No ReadTimeout/WriteTimeout for LLM inference - can take hours for large contexts
171+ IdleTimeout : 300 * time .Second , // 5 minutes for keep-alive connections
172+ ReadHeaderTimeout : 30 * time .Second , // Reasonable for headers only
173+ MaxHeaderBytes : 1 << 20 , // 1 MB for headers is sufficient
174+ }
169175
170176 // Create TLS certificates
171177 if s .config .SecureProxy {
@@ -181,6 +187,15 @@ func (s *Server) Start(ctx context.Context) error {
181187 }
182188 server .TLSConfig = & tls.Config {
183189 Certificates : []tls.Certificate {cert },
190+ MinVersion : tls .VersionTLS12 ,
191+ CipherSuites : []uint16 {
192+ tls .TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ,
193+ tls .TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,
194+ tls .TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ,
195+ tls .TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ,
196+ tls .TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 ,
197+ tls .TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 ,
198+ },
184199 }
185200 logger .Info ("server TLS configured" )
186201 }
@@ -233,6 +248,15 @@ func (s *Server) createRoutes() *http.ServeMux {
233248 decoderProxy .Transport = & http.Transport {
234249 TLSClientConfig : & tls.Config {
235250 InsecureSkipVerify : s .config .DecoderInsecureSkipVerify ,
251+ MinVersion : tls .VersionTLS12 ,
252+ CipherSuites : []uint16 {
253+ tls .TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ,
254+ tls .TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,
255+ tls .TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ,
256+ tls .TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ,
257+ tls .TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 ,
258+ tls .TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 ,
259+ },
236260 },
237261 }
238262 }
@@ -273,6 +297,15 @@ func (s *Server) prefillerProxyHandler(hostPort string) (http.Handler, error) {
273297 newProxy .Transport = & http.Transport {
274298 TLSClientConfig : & tls.Config {
275299 InsecureSkipVerify : s .config .PrefillerInsecureSkipVerify ,
300+ MinVersion : tls .VersionTLS12 ,
301+ CipherSuites : []uint16 {
302+ tls .TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ,
303+ tls .TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,
304+ tls .TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ,
305+ tls .TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ,
306+ tls .TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 ,
307+ tls .TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 ,
308+ },
276309 },
277310 }
278311 }
0 commit comments