Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactorNettyWebSocketClient WebSocket sub protocol handling broken in GatewayAutoConfiguration #2215

Closed
Johannes-Rost opened this issue Apr 16, 2021 · 1 comment

Comments

@Johannes-Rost
Copy link
Contributor

Johannes-Rost commented Apr 16, 2021

org.springframework.cloud.gateway.config.GatewayAutoConfiguration creates an instance of org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient with a reactor.netty.http.client.WebsocketClientSpec.Builder which is reused for multiple requests with different protocols.

This bug is almost the same as #2159 but for the WebSocketClient instead of the RequestUpgradeStrategy.

The bug was introduced in 3.0.x:

@Bean
@ConditionalOnEnabledGlobalFilter(WebsocketRoutingFilter.class)
public ReactorNettyWebSocketClient reactorNettyWebSocketClient(HttpClientProperties properties,
		HttpClient httpClient) {
	WebsocketClientSpec.Builder builder = WebsocketClientSpec.builder()
			.handlePing(properties.getWebsocket().isProxyPing());
	if (properties.getWebsocket().getMaxFramePayloadLength() != null) {
		builder.maxFramePayloadLength(properties.getWebsocket().getMaxFramePayloadLength());
	}
	return new ReactorNettyWebSocketClient(httpClient, builder);
 }

The WebsocketClientSpec.Builder implements Supplier<WebsocketClientSpec.Builder> but does not return a fresh instance when get() is invoked.

I will submit a pull request to fix this.

@spencergibb
Copy link
Member

Closing in favor of #2216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants