Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions charts/tim-api/templates/httproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ spec:
{{- range .Values.gateway.httpRoute.rules }}
- matches:
{{- toYaml .matches | nindent 8 }}
{{- if .timeouts }}
timeouts:
{{- if .timeouts.request }}
request: {{ .timeouts.request }}
{{- end }}
{{- if .timeouts.backendRequest }}
backendRequest: {{ .timeouts.backendRequest }}
{{- end }}
{{- end }}
backendRefs:
{{- range .backendRefs }}
- group: ""
Expand Down
5 changes: 5 additions & 0 deletions charts/tim-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ gateway:
- path:
type: PathPrefix
value: /
# Timeout configuration for streaming endpoints
# Set to 0s to disable timeouts (recommended for SSE/streaming)
timeouts:
request: 0s # Total request timeout (0s = no timeout)
backendRequest: 0s # Backend request timeout (0s = no timeout)
backendRefs:
- port: 3000 # Should match service.ports[0].port (external API)
weight: 1
Expand Down
9 changes: 5 additions & 4 deletions tim-api/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ func run(cmd *cobra.Command, args []string) error {
}

// Create external HTTP server
// External server needs longer timeouts for streaming responses
externalAddr := cfg.ExternalServer.Addr + ":" + cfg.ExternalServer.Port
externalHTTPServer := &http.Server{
Addr: externalAddr,
Handler: externalSrv,
ReadTimeout: 30 * time.Second,
ReadTimeout: 5 * time.Minute, // Longer for streaming responses
ReadHeaderTimeout: 10 * time.Second,
WriteTimeout: 30 * time.Second,
IdleTimeout: 120 * time.Second,
MaxHeaderBytes: 1 << 20, // 1 MB
WriteTimeout: 0, // No timeout for streaming writes (SSE)
IdleTimeout: 5 * time.Minute, // Longer for persistent connections
MaxHeaderBytes: 1 << 20, // 1 MB
}

// Create internal HTTP server
Expand Down
Loading