contour icon indicating copy to clipboard operation
contour copied to clipboard

Support setting MaxStreamDuration of both specific routes and globally

Open nickburgin opened this issue 9 months ago • 4 comments

Envoy has support for setting the MaxStreamDuration both globally and on a route, I suspect configuring this instead of an envoy route timeout would resolve some SSL issues we are seeing when a downstream system has it's request interrupted halfway through a stream entry (when requesting streaming data from one of our streaming endpoints).

Contour currently has no way of passing this configuration through to Envoy.

I have had a preliminary look at the contour code and the changes required to support setting this either globally or per route seem straightforward to me:

Route Specific:

  • Add MaxStreamDuration: envoy.Timeout(r.TimeoutPolicy.MaxStreamDuration) to the RouteAction in routeRoute()
  • Add MaxStreamDuration: string `json:"maxStreamDuration,omitempty"` to the TimeoutPolicy struct
  • Add MaxStreamDuration and error message to timeoutPolicy()

Global Default:

  • Add MaxStreamDuration timeout.Setting to the Timeouts struct
  • Add MaxStreamDuration and an error message to ParseTimeoutPolicy() function
  • Add MaxStreamDuration: *string `json:"maxStreamDuration,omitempty"` to the TimeoutParameters struct

I'm happy to open a PR to implement this.

nickburgin avatar Jan 22 '25 05:01 nickburgin