This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 84068fc6a6 [type:fix] Fix websocket plugin (#5126)
84068fc6a6 is described below
commit 84068fc6a6dfe080075be6f5ff10e6316d882bc5
Author: moremind <[email protected]>
AuthorDate: Fri Sep 8 11:35:20 2023 +0800
[type:fix] Fix websocket plugin (#5126)
* [type:fix] fix websocket error
* [type:fix] fix websocket error
---
shenyu-bootstrap/src/main/resources/application.yml | 4 ++++
.../main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java | 1 +
.../shenyu/plugin/response/strategy/NettyClientMessageWriter.java | 2 +-
.../shenyu/plugin/response/strategy/WebClientMessageWriter.java | 2 +-
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/shenyu-bootstrap/src/main/resources/application.yml
b/shenyu-bootstrap/src/main/resources/application.yml
index 35e279e540..d76907dd91 100644
--- a/shenyu-bootstrap/src/main/resources/application.yml
+++ b/shenyu-bootstrap/src/main/resources/application.yml
@@ -334,3 +334,7 @@ logging:
org.apache.shenyu.bonuspoint: info
org.apache.shenyu.lottery: info
org.apache.shenyu: info
+ org.springframework.http.server.reactive: info
+ org.springframework.web.reactive: info
+ reactor.ipc.netty: info
+ reactor.netty: info
diff --git
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-websocket/src/main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-websocket/src/main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java
index 3c91715bf3..eb047c1f10 100644
---
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-websocket/src/main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java
+++
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-websocket/src/main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java
@@ -140,6 +140,7 @@ public class WebSocketPlugin extends AbstractShenyuPlugin {
.startsWith("sec-websocket"))
.forEach(header -> filtered.addAll(header.getKey(),
header.getValue()));
+ filtered.remove(HttpHeaders.HOST);
return filtered;
}
diff --git
a/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/NettyClientMessageWriter.java
b/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/NettyClientMessageWriter.java
index 5a8f4b8944..3b37080925 100644
---
a/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/NettyClientMessageWriter.java
+++
b/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/NettyClientMessageWriter.java
@@ -79,7 +79,7 @@ public class NettyClientMessageWriter implements
MessageWriter {
@Override
public List<String> supportTypes() {
- return Lists.newArrayList(RpcTypeEnum.HTTP.getName(),
RpcTypeEnum.SPRING_CLOUD.getName());
+ return Lists.newArrayList(RpcTypeEnum.HTTP.getName(),
RpcTypeEnum.SPRING_CLOUD.getName(), RpcTypeEnum.WEB_SOCKET.getName());
}
private void cleanup(final ServerWebExchange exchange) {
diff --git
a/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/WebClientMessageWriter.java
b/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/WebClientMessageWriter.java
index 8ac2496e3a..f698f2969e 100644
---
a/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/WebClientMessageWriter.java
+++
b/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/WebClientMessageWriter.java
@@ -97,7 +97,7 @@ public class WebClientMessageWriter implements MessageWriter {
@Override
public List<String> supportTypes() {
- return Lists.newArrayList(RpcTypeEnum.HTTP.getName(),
RpcTypeEnum.SPRING_CLOUD.getName());
+ return Lists.newArrayList(RpcTypeEnum.HTTP.getName(),
RpcTypeEnum.SPRING_CLOUD.getName(), RpcTypeEnum.WEB_SOCKET.getName());
}
private void redrawResponseHeaders(final ServerHttpResponse response,