mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 14:57:54 -05:00
* fix(cloudfront): tunnel WebSocket upgrades to custom origins as AWS does CloudFront forwards WebSocket handshakes to the origin on every distribution, but Floci's serving path is a JAX-RS resource that strips Upgrade and Connection and fetches the origin with a blocking client, so a socket.io client behind a distribution never left long-polling. A Vert.x route ahead of JAX-RS now catches an HTTP/1.1 WebSocket handshake to a distribution host, resolves the behavior and custom origin as the GET path does (allowed methods, signed requests, origin request policy, origin custom headers, private-address guard), sends the handshake with its upgrade fields and splices the two connections once the origin answers 101. Any other answer is relayed as an ordinary response, and handshakes the distribution would not tunnel fall through to the existing GET handling. Handshake detection and the byte relay are shared with the ALB data plane. * fix(cloudfront): honor disabled service and origin timeouts on WebSocket refusals The WebSocket route runs ahead of ServiceEnabledFilter, so it now checks that CloudFront is enabled before taking a handshake and otherwise falls through to the disabled-service answer. An origin answer that refuses the upgrade is no longer piped without limits: its body is streamed within the origin's response timeout between packets and its response completion timeout in all, counting only the origin's time, and an origin that stalls past them ends the viewer connection. * test: share the ALB fixture between the WebSocket integration tests CloudFrontWebSocketIntegrationTest repeated ElbV2WebSocketIntegrationTest's load balancer, target group, listener and WebSocket exchange helpers. Both now use AlbFixtures. * refactor(cloudfront): have the WebSocket origin clock spend a shared CompletionBudget