【发布时间】:2019-10-12 13:57:26
【问题描述】:
我想在 spring 云网关上路由我的 websocket 服务
作为 Spring Cloud Gateway 文档,我尝试这样做并且它有效:
spring:
cloud:
gateway:
routes:
- id: websocket-sockjs-route
uri: http://localhost:8085
predicates:
- Path=/websocket/info/**
- id: websocket_route
uri: ws://localhost:8085
predicates:
- Path=/websocket/**
但是当我尝试这个时,它不会工作:
spring:
cloud:
gateway:
routes:
- id: websocket-sockjs-route
uri: http://websocket-service:8085
predicates:
- Path=/websocket/info/**
- id: websocket_route
uri: ws://websocket-service:8085
predicates:
- Path=/websocket/**
我想让我的 websocket 路由变成这样:
spring:
cloud:
gateway:
routes:
- id: hello-world-route
uri: lb://hello-world:8081
predicates:
- Path=/hello
【问题讨论】:
标签: spring-boot websocket spring-cloud-gateway